Search code examples
phpdrupalcrondrupal-6

Automating cron job in drupal 6


I am using Drupal 6. I want to run cron.php. So in crontab -e I configured "5 * * * * /usr/bin/wget -O - -q -t 1 http://eg.com/cron.php" so that cron run continuously for every 5 minutes.
In drupal cron maintence task settings, I found the last run was about 45 hours ago. If the scheduled "crontab " is working properly,the last run cannot be more than 5 minutes. I checked whether the crontab is working or not by means of viewing syslog file (/var/log/syslog).Where I could see that it is running. How could be the last run time was greater than 5 mins.


Solution

  • When troubleshooting cron task issues there are few avenues we can explore. Most of these techniques are outlined at the link below:

    https://www.drupal.org/node/553430

    Being that you verified the system crontab is running you want want to check the Drupal variables table to see when the last run was. With the devel module enabled you can simply go to /devel/variable and search for cron. This should coincide with what you are seeing on the status page (45 hours).

    In many cases I find this happens when cron didn't finish running before trying to start again. To test this you can delete the cron_semaphore and cron_last variables and try running again manually to ensure all cron tasks in Drupal are actually running successfully.

    Other then that I would review the link above. It is full of suggestions / solutions.

    Have fun!

    Nick