0

The following is a shell script (backup.sh)

rsync -abr --files-from='backup.txt' --delete --stats --progress --exclude={/home/rob} --log-file=/var/log/backup.log /home/ root@remote:/home/

I created the above as root. The backup.txt is 4 lines of simple path (/home/linda/ etc..)

I edited crontab to run monday through friday beginning at a certain time.

I can run the script manually and it works fine.

When I leave it to run on it's own and I come back and look at the log, it shows 2 errors:

rsync: failed to open files-from file backup.txt: No such file or directory
rsync error: syntax or usage error (code 1) at main.c(1453) [client=3.0.9]

What am I doing wrong or forgetting?

  • Why curly parenthesis around /home/rob/? – Oli Jun 7 '13 at 13:44
2

Be super-explicit with paths when using cron (or anything where you don't know what environment it's going to be executed from). Use the full path for backup.txt.

And the second error could be related to that or it might be blowing up on the curly brackets you've got in --exclude={/home/rob}. No idea what you're trying to do there. Just use quotes.

  • I have edited the script to reflect the full path to /root/scripts/backup.txt and also replaced the brackets with quotes. I will let it run on it's own to see how it does and report back. Thank you for your help. – user165252 Jun 7 '13 at 14:15
  • 1
    Just reporting back that it's working flawlessly! thank you! – user165252 Jun 12 '13 at 15:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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