Backup with rsync works but not in crontab
Using this command in rsync:
rsync -azvh [email protected]:/media/PNY/video /home/john/Desktop/Pi\ Videos
Works flawlessly. Now, when I put this command in crontab to run every 15 minutes, it does not work and I am wondering if my command in crontab is correct?
*/15 * * * * rsync -avzhe ssh [email protected]:/media/PNY/video /home/john/Desktop/Pi\ Videos
Wow, What a dig! I found the answer on linuxquestions.org
CLI and crontab run on different environments. Crontab needs to be told where the private key is. I followed the instructions on the link and simply added the location of private key on the command and it worked. The previous command now has this addition added.
*/15 * * * * rsync -avzhe "ssh -i /home/john/.ssh/id_rsa_dvr.pi" [email protected]:/media/PNY/video /home/john/Desktop/Pi\ Videos
Now on to find a doctor that can help get some of these roots put back in. :-)
I suppose without parameters there is no need to use "-e" and "ssh" option in the scheduled command. Please try it plain:
*/15 * * * * rsync -avzh [email protected]:/media/PNY/video /home/john /Desktop/Pi\ Videos