Experimental project

This is a sandbox project, which contains experimental code for developer use only.

UPDATE: This module is somewhat discontinued. See Ultimate Cron instead.

This module is inspired by the Elysia Cron module (a big thanks to Eric Berdondini)
The module takes over the normal operations of cron, and parallelises each job, so they can
run concurrently

Features:
- Completely transparent, eg. compatibility mode for cronapi support only.
- crontab-like scheduling configuration of each job.
- TRUE parallel execution of jobs, through multi_curl
- time statistics of each job
- modules can define extra cron tasks, each one with own default cron-rules (site administrators can override them by configuration).
- protection from external cron calling by magic key.
- group jobs together to split load onto multiple server. call parallel_cron.php with ?group=[groupname]
- enable/disable jobs

Example code:

// Default cron-function, configurable through /admin/build/cron/settings
function mymodule_cron() {
  // Do some stuff ...
}


// Define custom cron functions
function mymodule_cronapi($op, $job = 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($job) {
        case 'mymodule_cronjob_1': return '*/13 * * * *';
        case 'mymodule_cronjob_2': return '0 0 1 * *';
      }
      break;

    case 'execute':
      switch($job) {
        case 'mymodule_cronjob_2':
          mymodule_somefunction();
          break;
      }
      break;
  }
}

// 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 ...
}

// Easy-hook, uses rule: 0 * * * *
function mymodule_hourly() {
  // Do some stuff
}

// Easy-hook, uses rule: 0 0 * * *
function mymodule_daily() {
  // Do some stuff
}

// Easy-hook, uses rule: 0 0 * * 1
function mymodule_weekly() {
  // Do some stuff
}

// Easy-hook, uses rule: 0 0 1 * *
function mymodule_monthly() {
  // Do some stuff
}

// Easy-hook, uses rule: 0 0 1 1 *
function mymodule_yearly() {
  // Do some stuff
}

Credits

This module was sponsored by Berlingske Media A/S

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution No further development
    No longer developed by its maintainers.
  • Module categories: Administration Tools
  • Created by gielfeldt on , updated