GVS is now part of Acquia. Acquia logo

cron

Greg's picture

Ubuntu cron Isn't Running? Some things to check:

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 all 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.

An Extension on Your Program Name in /etc/cron.*/

Cron has very specific rules about file names. In fact, those rules are:

same naming convention as used by run-parts(8): they must consist solely of upper- and lower-case letters, digits, underscores, and hyphens.

So, don't put a period nor file "extension" on those files.

Cron Scripts Inherit A Limited Environment

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.

Make Sure The Jobs are in /etc/crontab and Cron/Anacron are installed

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:

sudo apt-get install cron anacron

Make a Basic Script and Check the Cron Log

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

echo $PATH > /tmp/cron_path.txt

Syndicate content

GVS is now part of Acquia.

Acquia logo

Contact Acquia if you are interested in a Drupal Support or help with any products GVS offered such as the Conference Organizing Distribution (COD).

We Wrote the Book On Drupal Security:

Cracking Drupal Book Cover