Solving cron problems

Last modified: October 4, 2009 - 20:59

There can be several reasons why cron will not run on your site. Issues with cron can make that cron hangs, redirects or gives a 404 error.
Try the following checklist to solve problems with cron:

  • Try if you can run cron manually: go to admin/reports/status and click the "run cron manually" link. If it runs you need to check your setup of crontab, see http://drupal.org/cron. A less recommended solution, but acceptable if you don't need a very regular cron run, is to install the Poormanscron module.
  • If the "run cron manually" link does not work it means there is a problem with cron itself
    • Cron might be cached in a bad way. Clear cache on admin/settings/performance. Or truncate all tables starting with cache_. Or you could search for cached instances of cron.
    • Cron takes too long to run. If cron has never run before and your site is allready some time online, certain tables that need to be cleaned by cron might be huge. Check the size of the watchdog, sessions or acceslog tables and truncate (empty) if needed.
    • If your server has restarted during a cron run, you might need to delete two cron variables. Search in the variables table for cron_last and cron_semaphore and delete these entries.
      USE Name_Of_Your_Drupal_Database;
      DELETE FROM variable WHERE name="cron_semaphore";
    • Certain modules might cause cron not to run or give a 404 error (page not found). Disable suspect modules (those that call hook_cron) one by one and try to run cron manually every time. You can check if a module uses cron with
      <?php
       
      echo theme('item_list', module_implements('cron'));
      ?>
    • If cron.php gets redirected you might have the issue http://drupal.org/node/102138 with drupal_goto(), try one of the solutions there.
 
 

Drupal is a registered trademark of Dries Buytaert.