Am trying Lingon. The only issue is Lingon is less flexible with the schedule. I want to run some things every other day, and lingon does not offer it without creating multiple jobs for each day to run it. So that would be 3 or 4 jobs for every backup server I want, and I have a lot.
Going to see if it works first, then use it in the short term, then need to look into something with more flexible scheduling like cron.
I fond Launchd Editor, but it seems its not live any more.
Still get the issue with Lingon...
The console logs shows the same error I get mailed to me when using Cron. That is "Permission Denied" which I believe refers to using SSH with password less keys.
To confirm, the backup script runs fine in terminal. The script is being executed using Cron and Lingon, but rsync via SSH is not being run when using Cron and Lingon.
When I say password less, there is a password I just dont enter it. When I created the keys I entered a password. Then when I connect first time it asks for a password (in a pop up window not terminal) and asks to add it to keychain. Subsequent connects I am never prompted for a password.
Just wanted to mention that in case it is related, maybe cron or launchd cannot access keychain or something?
I would rather get cron working, or know it cant
From man crontab
(Darwin note: Although cron(8) and crontab(5) are officially supported under Darwin, their functionality has been absorbed into launchd(8), which provides a more flexible way of automatically executing commands. See launchctl(1) for more information.)
Have a look at this page, hope you can find useful tips
I believe the issue lies with cron/launchd not being to access the SSH Agent....
Using a few commands online I found did not fix this:
eval "/usr/bin/ssh-agent -s"
I get the error:
Could not open a connection to your authentication agent
Finding it quite unbelievable that we cant use rsync and ssh in a cron/launchd with password protected SSH keys. This must be very common for backups. I have perfected my script which took ages, and I cant automate it.
Seems a lot of websites say create a password-less keys (just hit enter when prompted), but this is less secure, so not acceptable. Have not tried it.
YES! Got it working, finally!
So the issue is indeed cron/launchd not being able to access the ssh-agent which holds the key.
So this is the solution...
Download keychain for Mac:
Then once its installed and configured, the script to run needs this added to the top:
eval `keychain --noask --eval id_rsa` || exit 1
Note I am using id_rsa whereas keychains instructions refer to id_dsa so I just changed it and it works OK.
When the script runs the first time it asks for the key password. Then it works from then on.
What I do not know yet is will I need to re-enter the password when I logoff/logon again. That will cause an issue as I auto restart the Mac every day which means if I am off for a few days backup will stop (can you see the madness in this issue!).