Cron job not running - script uses rsync, ssh (with id_rsa)
Does anyone know how to get cron to run a rsync/ssh script which uses id_rsa for passwordless logins?
I have a backup script I have slaved for months over that works wonderfully when running it from the command line.
It uses rsync and connects with SSH (passwordless using ssh keys). I have setup id_rsa and id_rsa.pub for passwordless logins (this is my user account, and connects using root@ to the server)
As stated all works find when run from the command line. But when I setup a cron job to run this file (exact same line I run from the command line) it does not execute. Actually, it does run, as I have an email notifiction which sends to me. It is just the rsync/ssh part that does not run.
I have spent days and days trying to figure it out. No error messages occur, nothing. Took me a while to find out cron is emailing the user account on Lion the messages (not to a proper email address).
The error shows a permission denied, which I believe to be the cron user cannot use the id_rsa/ssh connection.
Cron is running the script as my user, the same I use on the command line. I even tried copying the id_rsa to the root user .ssh folder in case cron is running as root but that does not work either.
So does anyone know how to get cron to run this rsync/ssh script which used id_rsa for passwordless logins?
Thanks a lot
iMac, Mac OS X (10.7.3)