Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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.