The Ultimate Cron handling for Drupal.
Runs cron jobs individually in parallel using configurable rules, pool management and load balancing.
Looking for help: Anyone interested in writing a handbook for Ultimate Cron?
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 Queue (also in Drupal 6 using the Drupal Queue module)
- 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
- Background process driven poormans cron with a granularity of 1 minute
- Drush support (list, start, enable/disable jobs from the command line)
Dependencies
Supported 3rd party modules
Ultimate Cron add-on modules
- Ultimate Cron Daemonizer: Daemonize cron jobs allowing finer resolution than once per minute
- Ultimate Cron Queue Scaler: scales/throttles queue processing
- Ultimate Cron Serializer: Run specific jobs in serial instead of parallel threads
- Background Process Apache Server Status: Self-healing for dead jobs
Server setup
Drupal 7 does not need a crontab setting on the server with the introduction of Poormans Cron. This practice has been adopted in Ultimate Cron also for Drupal 6. It is no longer necessary to enable cron on your server. Running cron does not affect the user requesting the page, as the cron run itself is dispatched to a background process.
However, it is recommended to disable poormans cron and use the servers crontab to call cron.php every minute, if possible.
Process management
The Poormans cron process is delegated to the service host "ultimate_cron_poorman". See the Background Process module for settings up service groups and service hosts.
Credits
Ultimate Cron is the product of, among other things, the inspiration from other cron modules,
- Elysia Cron: hook_cronapi(), interface
- CronPlus: easy hooks (hook_daily(), etc.)
- SuperCron: parallelization technique, interface
Developer
See full documentation through Advanced Help
Example implementation of cron jobs:
// Define custom cron functions
function mymodule_cronapi($op, $function = NULL) {
switch($op) {
case 'list':
return array(
'mymodule_cronjob_1' => 'Cron-1 Handler',
'mymodule_cronjob_2' => 'Cron-2 Handler',
'mymodule_cronjob_3' => 'Cron-3 Handler',
);
case 'rule':
switch($function) {
case 'mymodule_cronjob_1': return '*/13 * * * *';
case 'mymodule_cronjob_2': return '0 0 1 * *';
}
break;
case 'execute':
switch($function) {
case 'mymodule_cronjob_2':
mymodule_somefunction();
break;
}
break;
case 'settings':
switch ($function) {
// 'mymodule_cronjob_3' disabled by default
case 'mymodule_cronjob_3': return array('enabled' => FALSE);
}
case 'configure':
switch ($function) {
case 'mymodule_cronjob_3': return 'admin/configure-modules-settings/xxx';
}
}
}
// Custom cron-function
function mymodule_cronjob_1() {
// Do some stuff ...
}
// Custom cron-function
function mymodule_somefunction() {
// Do some stuff ...
}
// Custom cron-function
function mymodule_cronjob_3() {
// Do some stuff ...
}Caveat
Configuration
In many cases (if not most) Ultimate Cron will work out-of-the box. However, on some installations it might be necessary to configure Background Process through settings.php in order for Ultimate Cron to work.
Please refer the the Background Process documentation.
Drush
Be aware that drush core-cron is incompatible with Ultimate Cron. When running core cron through drush, locks are not set properly, and Ultimate Cron might run jobs concurrently.
Postgress
Unfortunately, I've discovered that Ultimate Cron isn't postgres compatible :-(
For those running postgres, there are 6.x-1.x-postgres branches available for the modules involved: Progress, Background Process and Ultimate Cron.
Downloads
Recommended releases
Development releases
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Administration, Developer, Drush, Performance and Scalability, Utility
- Reported installs: 249 sites currently report using this module. View usage statistics.
- Downloads: 2,271
- Last modified: May 14, 2012

