Drupal cron failing? Not sure why? here's a handy drush command.

More often than I'd like I see issues where Drupal's cron fails or exceeds the time limit. Here is a handy Drush command which will run all cron hooks on your site and the time it takes to run. This will allow you to see which cron it fails on, and which ones run slowly. From there you can look at the hook_cron for that module and work out why it failed or why it is slow. The most common issue I see is related to search indexing and nodes that have php in with drupal_goto() or similar. Drupal tries to index the node, ends up following the goto, and forgets to continue with cron.

drush php-eval ' global $timers; $hook = 'cron'; $return = array(); foreach (module_implements($hook) as $module) { $function = $module . '_' . $hook; print($function ." - "); timer_start($function); $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) { $return = array_merge_recursive($return, $result); } else if (isset($result)) { $return[] = $result; } timer_stop($function); print($timers[$function]['time'] ."\r\n"); }'

Simple SEO PDF guide

Get our latest PDF guide, Simple SEO.

Similar posts

Mailing list

Subscribe for monthly updates, blog posts, and client case studies direct to your inbox.

Twitter