Drupal - How to get list of cron tasks?

Or simple use

drush ev 'var_dump(module_implements("cron"))'

For list the cron job that exists.


If you don't have Elysia Cron installed, and from a purely debugging standpoint, if you want or need to see what module's cron is running, as well as how long it is taking to run, you can TEMPORARILY edit includes/common.inc's drupal_cron_run() function like so...

// Iterate through the modules calling their cron handlers (if any):
// module_invoke_all('cron'); // watchdog how long each hook takes now...

$details='';
foreach (module_implements('cron') as $module) {
  $start=microtime(TRUE);
  $function = $module . '_cron';
  $function();
  $finish=microtime(TRUE);
  $duration=$finish - $start;
  $details.='<pre>' . $module . ': ' . $duration . ' seconds</pre>';
}

// Record cron time
variable_set('cron_last', time());
watchdog('cron', 'Cron run completed.' . $details, array(), WATCHDOG_NOTICE); // . in $details here :)

eg, comment out the module_invoke_all() and instead loop through via module_implements() and log how long each individual cron run takes.

Tags:

Cron