Cron list
Logs page
Edit job

The Ultimate Cron handling for Drupal.
Runs cron jobs individually in parallel using configurable rules, pool management and load balancing.

2.0 READY FOR BETA TESTING!

Ultimate Cron 2.0 beta is out now. The only Drupal module with a cracker intro! (warning: iPhone killer ...)

Ultimate Cron 1.x documentation can be found at https://drupal.org/node/1666944

The old project page for Ultimate Cron 1.x can be found at https://drupal.org/node/2195381

Changes

  • No more dependecy to Background Process. Ultimate Cron now works without Background Process. However, Background Process is still supported for true parallelism
  • Refactored to use cTools plugins, making it easier to extend Ultimate Cron.
  • Now includes the daemonizer and queue throttling features, previously found in the modules Ultimate Cron Daemonizer and Ultimate Cron Queue Scaler
  • Hopefully a more robust lock and logging mechanism.
  • Integration with nodejs for live update on cron page
  • Nagios support has not been re-implemented (yet?)

Upgrade path

  • Disable cron while upgrading.
  • Existing db-stored settings will be upgraded.
  • Existing features containing Ultimate Cron settings will be stored in db, for easier re-export.
  • Existing log table will be modified. Beware, that if the table contains many entries, the upgrade may take some time.

Plugins

Ultimate Cron is built upon 4 plugin types.

  • Settings: - plugins that provide custom settings for jobs (bundled: general, queue).
  • Schedulers: - plugins that provide a mechanism for whether or not a job should run at a certain time (bundled: simple, crontab).
  • Launchers: - plugins that provide a way of launching jobs (bundled: serial, background_process).
  • Loggers: - plugins that provide a logging backing for job status (bundled: database, cache).

Ultimate Cron 2.x documentation can be found at https://drupal.org/node/2195383

Features

  • Works out-of-the box in most cases (or aims to)
  • Parallel exection of cron jobs
  • Configuration per job (enable/disable, rules, etc.)
  • Multiple rules per cron job
  • Pool management and load balancing using Background process
  • Support for Drupal Queues
  • Overview of cron jobs
  • Log history of cron jobs
  • Status/error messages per cron job, providing easy debugging of troublesome cron jobs
  • Uses hook_cronapi() (Elysia Cron compatible, NOT 2.x, please use hook_cron_alter() for similar functionality)
  • hook_cron_alter() for easy adding/manipulating cron jobs
  • Poormans cron with keepalive a granularity of 1 minute
  • Drush support (list, start, enable/disable jobs from the command line)

Dependencies

Supported 3rd party modules

Declaring new cron jobs

From ultimate_cron.api.php

<?php
/**
* Inform Ultimate Cron about cron jobs.
*
* Note that the result of this hook is cached.
*
* @return array
*   Array of cron jobs, keyed by name.
*    - "title": (optional) The title of the cron job. If not provided, the
*      name of the cron job will be used.
*    - "file": (optional) The file where the callback lives.
*    - "module": The module where this job lives.
*    - "file path": (optional) The path to the directory containing the file
*      specified in "file". This defaults to the path to the module
*      implementing the hook.
*    - "callback": (optional) The callback to call when running the job.
*      Defaults to the job name.
*    - "callback arguments": (optional) Arguments for the callback. Defaults
*      to array().
*    - "enabled": (optional) Initial state of the job. Defaults to TRUE.
*    - "tags": (optional) Tags for the job. Defaults to array().
*    - "settings": (optional) Default settings (plugin type) for this job.
*      Example of a job declaring some default settings for a plugin called
*      "some_plugin":
*      'settings' => array(
*        'some_plugin' => array(
*          'some_value' => 60,
*        ),
*      ),
*    - "scheduler": (optional) Default scheduler (plugin type) for this job.
*      Example of a job using the crontab scheduler as default:
*      'scheduler' => array(
*        'name' => 'crontab',
*        'crontab' => array(
*          'rules' => array('* * * * *'),
*        ),
*      ),
*    - "launcher": (optional) Default launcher (plugin type) for this job.
*      Example of a job using the serial launcher as default:
*      'launcher' => array(
*        'name' => 'serial',
*        'serial' => array(
*          'thread' => 'any',
*        ),
*      ),
*    - "logger": (optional) Default logger (plugin type) for this job.
*      Example of a job using the cache logger as default:
*      'logger' => array(
*        'name' => 'cache',
*        'cache' => array(
*          'bin' => 'mycachebin',
*        ),
*      ),
*/
function hook_cronapi() {
 
$items = array();
 
$items['example_my_cron_job_1'] = array(
   
'title' => t('This is my cron job #1'),
   
'file' => 'example.jobs.inc',
   
'file path' => drupal_get_path('module', 'example') . '/cron',
   
'callback' => 'example_my_cron_job_callback',
   
'callback arguments' => array('cronjob1'),
   
'enabled' => FALSE,
   
'tags' => array('example'),
   
'settings' => array(
     
'example_plugin' => array(
       
'example_setting' => 'example_value',
      ),
    ),
   
'scheduler' => array(
     
'name' => 'crontab',
     
'crontab' => array(
       
'rules' => array('* * * * *'),
      ),
    ),
   
'launcher' => array(
     
'name' => 'serial',
     
'serial' => array(
       
'thread' => 'any',
      ),
    ),
   
'logger' => array(
     
'name' => 'cache',
     
'cache' => array(
       
'bin' => 'my_cache_bin',
      ),
    ),
  );
  return
$items;
}
?>

In fact, all options are optional, so the most minimal way of declaring a new cronjob is:

<?php
/**
* Implements hook_cronapi().
*/
function example_cronapi() {
 
$items = array();
 
$items['example_my_cron_job'] = array();
  return
$items;
}
/**
* The callback for the cron job,
*/
function example_my_cron_job($job) {
}
?>

Project Information

Downloads