Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
So, you cannot run rsync as a daemon, to utilize the --bwlimit switch)? –  Christopher Jan 18 '13 at 2:26
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
    
@jordanm Thanks! Just because I read it under the DAEMON OPTIONS does not mean that it is exclusive to daemon mode. –  Christopher Jan 18 '13 at 13:46

1 Answer 1

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).

share|improve this answer
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. –  Gilles Jan 18 '13 at 23:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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