Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to run rsync over an adsl connection, only when i'm not using it (from midnight to the 6am). The download of the files has to stop on 6am, and resume on midnight. There are both huge files (hundreds of GB) and little ones (a few GB).

How can i do it automatically?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I would simply suggest using two crontabs

  • one that starts the transfer with for instance "--partial --update" (and possibly others)
  • one that kills the transfer (something like) "kill $(ps aux | grep '[r]sync' | awk '{print $2}')"
share|improve this answer
1  
pkill rsync, if you have pkill. No need to grep then awk. –  cjc Apr 23 '12 at 12:44

You can run rsync -au src dest at midnight by scheduling a cron job. Using -u option will prevent copying everything again.

You can also (using a cron job at 6am) run a script to look for running rsync command and kill it using SIGTERM.

share|improve this answer

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.