Score:0

rsync skip transferring files that take longer than n minutes

in flag

I run rsync as a cron job within a script. Sometimes transfer speed falls down and my large files (say over 1G) take so long to transfer and this stops my script functionality. Is there a way I can tell rsync to stop sending a file if it takes more than n minutes?

In other words, I want to run a rsync command to send a large file to my remote machine. If the transfer finished successfully before n minutes, good to go. If it did not I want rsync give up and continue running the rest of script.

Score:1
in flag

I found out that this is what is timeout command intended to do. If you want to let the main command communicate with the terminal you need to pass --foreground switch.

timeout --foreground 300 rsync ./local_file user@server:/remote/file

This will terminate rsync after 5 minutes.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.