Is there a way to pause rsync via command line, if it transfers data for over X minutes? I'm working on using it as a backup and would like it to pause every once in a while to prevent the hard disks from overheating or network throttling. I am currently using a Windows batch file to start a Linux bash script via cygwin to do this.

  • 1
    @Christopher You do not need to run rsync as a daemon to use the --bwlimit switch.
    – jordanm
    Jan 18 '13 at 3:36
  • Pausing a network command is tricky, you will likely run into timeouts.
    – scai
    Jan 18 '13 at 7:11

If you can get the PID of the process, you can use

kill –STOPpid

to pause the process, and

kill –CONTpid

to resume it.  Check the exit status; if the kill command fails, the first assumption is that the process no longer exists (because it has finished).

  • 1
    If you have one rsync instance running, you can get the PID by ps | command grep rsync | awk '{print $1}'. You can run your command in a while script with a sleep function in between.
    – Bernhard
    Jan 18 '13 at 6:40
  • Note however that if you pause rsync for too long, its TCP connection will eventually time out. How long you have depends on how intermediate firewalls are configured. Jan 18 '13 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.