May 25, 2009

cron running scripts

Forums: 

Hi. I've been reading about cron and I think it's a pretty useful utility. However, I've had a bit of trouble with it running scripts.

I'm running Ubuntu 9.04 with Gnome, by the way.

For example, if I put the following line into my crontab

* * * * * ~/script
(I've tried variations of this using the full path to the script and the $HOME variable.)

And I wait a minute or so, nothing happens. In the System Log Viewer an entry in syslog is added every minute saying that the script was being run, but nothing actually happens. I tried redirecting the output to a file, but the file is blank after the script is run. No errors are shown. I tried "sudo chmod a+rwx" on the script (just in case the script wasn't being run due to permissions issues) but it still isn't working...

Crontab works for other things though. I use it as an alarm clock with

30 5 * * * export DISPLAY=:0 && firefox pandora.com

...and it works as expected.

I'm confused as to why I can't seem to get the program to run the script, or failing that give any sort of error message.

My script, by the way, isn't that complicated, and it works properly when running it regularly...

#!/bin/bash
git add .
git commit -m "Commit on `date`"

Has anyone dealt with this issue before? Any help would be appreciated. :)

~Dennis

Click Here!