I am trying to cron an rsync sync over ssh, but for some reason, as soon as I put the command in cron, it won't run. I don't know what is causing it to break, but it is certainly something related to the fact that it is placed in cron because:
- If i copy paste the command in my shell prompt, it will execute as expected.
- if I replace the command in cron by a simple command such as
date > /root/synclog.log
, cron does fire it up as expected.
Here's the code:
* * * * * flock -n /root/synclockfile -c "rsync -avv --stats -h --log-file=/root/synclog.log --log-format='%t %f %b' --ignore-existing -e ssh /shares/myshare/PHOTOS/ my_server_hostname:/backups/PTHOTOS"
What could be wrong?
$PATH
. 2) escape your%
signs. Seeman 5 crontab
.