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 use rsync to synchronise my home folder with a "backup" copy on another drive on an Ubuntu 11.10 machine. And I want it to happen every 15 minutes.

If I manually run:

rsync -ar --delete /home/user/ /backupdrive/

in the CLI, it works just fine - everything in in sync.

But I've added:

*/15 * * * * rsync -ar --delete /home/user/ /backupdrive/

to sudo crontab -e and whilst it adds new files, it doesn't delete the old ones.

Any ideas?


The first three lines of the cron out.txt are:

sending incremental file list
IO error encountered -- skipping file deletion

This doesn't happen with the CLI version.

share|improve this question
Try running the same command after adding -v option and redirect the output to a file. Then, check the file. – Khaled Apr 18 '12 at 11:56
Okay, so I added '> out.txt' in both cases. For the CLI version it's clearly adding and deleting files. On the crontab version, I can't find the out.txt file anywhere in the filesystem!!! But it is adding files - just not deleting them...?!? – user114671 Apr 18 '12 at 15:03
@user114671 you need to specify an absolute path to out.txt. So > /tmp/out.txt for example. Otherwise its going to put out.txt in whatever directory cron is running from. – Patrick Apr 19 '12 at 1:31
Thanks Patrick, completely forgot that. I'll edit the entry above to show the output... – user114671 Apr 19 '12 at 7:38

If you're using SSH authentication in your interactive shell implicitly for rsync, you'll need to set that up explicitly for use in cron. This can be tricky to lock down with SSH keys that need to work without passphrases, since ideally one would want to constrain where the rsync output can end up the far end.

You can use the ~/.ssh/authorized_keys file to configure the key to only run a given specific command when someone connects to the host. If rsync in daemon mode can be forced to put everything under a target directory specified in the /.ssh/authorized_keys file "command" entry, it'd even be fairly secure. The rsyncd.conf(5) page has some relevant options for this kind of thing.

share|improve this answer
Thanks Alex. My apologies for not being clearer - both /home/user and /backupdrive are on the same machine – user114671 Apr 18 '12 at 12:26

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.