Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got a couple of scripts that I've had scheduled to run in cron for a while. About a week or so ago, they stopped running as far as the (very basic) logging showed, and also I noticed that my wallpaper wasn't being rotated any more.

josh@sirius:~$ crontab -l
# m h  dom mon dow   command
0 * * * * /bin/bash /home/josh/bin/rotate-wallpaper
*/30 * * * * /bin/bash /home/josh/bin/download-programmes
* * * * * echo "I ran" > /home/josh/cronstamp

Neither of the first two commands are run, but the ~/cronstamp file does get created and written to as expected.

share|improve this question

3 Answers 3

Looks like your scripts are failing. I would suggest adding 2>&1 > /home/josh/cronlog at the end of your commands, this way you will be able to later inspect what went wrong

Example:

# m h  dom mon dow   command
0 * * * * /bin/bash /home/josh/bin/rotate-wallpaper 2>&1 > /home/josh/cronlog
*/30 * * * * /bin/bash /home/josh/bin/download-programmes 2>&1 > /home/josh/cronlog
share|improve this answer

Try reloading the cron jobs:

sudo service reload

available options are:

sudo service {start|stop|status|try-restart|restart|force-reload|reload|probe}
share|improve this answer
    
This doesn't seem to have made a difference. –  dutchie Jan 30 '12 at 10:26

Do your scripts depend on GUI elements (I guess so, since you talk about wallpapers)? Then I guess this won't work, as it misses out on some environment variables in Cron, opposed to running in a terminal window.

If you just need the $DISPLAY and you are not running multiple X-windows, set it like this in your script (on top):

DISPLAY=:0

Maybe more are missing. Try debugging further and log all stdout and stderr output from all commands in your scripts as @zakkak explains.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.