I've been trying to run a sh script using crontab today.
It's a script that pushes changes to a folder on the server, where users upload files etc, to an SVN repository. The script works when I run it from the command line as 'sh svnauto.sh'.
I added the cron job using panel.dreamhost.com. I set the frequency to every 10 minutes so I could see if it was working, and set the email to my email also to see if it was working.
I checked the crontab with crontab -l when logged in via ssh. And it seems the cronjob was added correctly. In the crontab -l I can see the following:
*/10 * * * * sh -c $'/bin/sh /home/myuser/svnauto.sh'
And the bash script looks like as follows:
svn add * --force
svn commit -m "Automatic SVN push"
I'm wondering if it's the different environment that the cron job runs in compared to when I run the script from the shell. When I run the script from the shell it doesn't ask to save password or what the password is, because I've set it up so it remembers the password so that the script can run without any input from me. If the enviroment that the cron job runs in doesn't have this set, then maybe I need a way to automatically input the password.
If the cron job is stopped mid way through as the svn command is asking for a password, does that mean that I won't receive an email or notification of it's failure to run?
I've changed the script to use full file paths for everything, as well as to use the username & password in the command line to hopefully eliminate any promps that stop the script :
/usr/bin/svn update --username $username --password $password
/usr/bin/svn add * --force
/usr/bin/svn commit -m "Automatic SVN push" --username $username --password $password
Running the script from the ssh shell works. I'll post back in 10 minutes if it has worked for the cron tab or not.
Still not running