2

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?

jdeo
  • 21
  • Use absolute paths. 90% of cron issues are because the command you're trying to use isn't in $PATH. 2) escape your % signs. See man 5 crontab.
  • – phemmer Jun 18 '16 at 19:42