Growing Venture Solutions - GVS - ubuntu http://growingventuresolutions.com/taxonomy/term/21/0 en Ubuntu cron Isn't Running? Some things to check: http://growingventuresolutions.com/blog/ubuntu-cron-isn-t-running-some-things-check <p>I had some issues where cron wasn't running the scripts that I had placed into /etc/cron.hourly nor /etc/cron.daily and I spent a bit of time trying out different things to figure out how to fix it. Here are some of the things I fixed. I think the problems were, in fact, not <em>all</em> present but several were which meant every time I thought I had it fixed I would come back later and see it was still wasn't running.</p> <h3>An Extension on Your Program Name in /etc/cron.&#42;/</h3> <p>Cron has very specific rules about file names. In fact, those rules are:</p> <blockquote><blockquote><p>same naming convention as used by run-parts(8): they must consist solely of upper- and lower-case letters, digits, underscores, and hyphens.</p> </blockquote> </blockquote> <p>So, don't put a period nor file "extension" on those files.</p> <h3>Cron Scripts Inherit A Limited Environment</h3> <p>Unless you've added information to the top of your /etc/crontab, the environment for the user that runs cron jobs will be very limited. All commands and shell scripts should be prefixed with the path (i.e. "/usr/bin/mysqldump" instead of "mysqldump"). Specifically state the shell at the top of the file.</p> <h3>Make Sure The Jobs are in /etc/crontab and Cron/Anacron are installed</h3> <p>Just because you're using "Ubuntu" doesn't mean it's the same Ubuntu that you're used to. Make sure that appropriate jobs have been added to the /etc/crontab file. It's possible that cron/anacron won't be installed on the system. If not, try:</p> <blockquote><blockquote><p>sudo apt-get install cron anacron</p> </blockquote> </blockquote> <h3>Make a Basic Script and Check the Cron Log</h3> <p>Depending on your system this may be in different places, but for me it was in /var/log/syslog. If that isn't helpful, try adding debugging statements to different scripts to make sure they are running and test different assumptions along the way. You can also try creating a script that will get executed first ("aaa_test_script" is my favorite) and make it do something really trivial like</p> <blockquote><blockquote><p>echo $PATH &gt; /tmp/cron_path.txt</p> </blockquote> </blockquote> <p>If that doesn't work - you know you're in big trouble. If it does work - that's a small building stone to start with and it gives you some information about the environment variables (i.e. the $PATH).</p> <p>If you're struggling with this problem, I hope that one or more of these solutions will help you. If not...just keep trying ;)</p> http://growingventuresolutions.com/blog/ubuntu-cron-isn-t-running-some-things-check#comments cron linux sysadmin ubuntu Sat, 15 May 2010 00:00:00 +0000 Greg 165 at http://growingventuresolutions.com