Elysia Cron
gotheric - June 24, 2008 - 16:35
Extended cron support with crontab-like scheduling (you can run some cron hooks every day at a specified hour, other only monthly and so on...) and other features:
- crontab-like scheduling configuration of each job.
- grouping of jobs in channels (parallel lines of execution).
- you can disable all jobs, an entire channel or a single job via configuration.
- force execution of a single cron job on demand
- change the priority/order of job execution
- time statistics of each job and of the whole channel.
- modules can define extra cron tasks, each one with own default cron-rules (site administrators can override them by configuration).
- administrators can define custom jobs (call to functions with parameters)
- protection from external cron calling by cron_key or allowed host list.
- ensure all shutdown hook functions launched by cron jobs are launched inside
cron protection (ex: search_cron() will launch search_update_totals() in a
shutdown hook).
Example of a cron script
Note: this is only a way to configure scheduling, there is also a simpler guided configuration.
# Search indexing every 2 hours (i'm setting this as the job description)
0 */2 * * * search_cron
# I'll check for module status only on sunday nights
# (and this is will not be the job description, see the empty line below)
0 2 * * 0 update_status_cron
# Trackback ping process every 15min and on a channel called "net"
*/15 * * * * ctx:net trackback_cron
# Disable node_cron (i must set the cron rule even if disabled)
- */15 * * * * node_cron
# Launch function send_summary_mail('test@test.com', false); every night
# And set its description to "Send daily summary"
# Send daily summary
0 1 * * * send_summary_mail('test@test.com', false);Example of a module defining its cron jobs
// Assume your module needs 2 cron tasks: one executed every hour (process_queue)
// and one executed once a day (send_summary_mail).
function module_cronapi($op, $job = NULL) {
switch ($op) {
case 'list':
return array(
'module_process_queue' => 'Process queue of new data',
'module_send_summary_mail' => 'Send summary of data processed'
);
case 'rule':
if ($job == 'module_process_queue') return '0 * * * *';
else return '0 1 * * *';
case 'execute':
if ($job == 'module_process_queue') {
... do the job ...
}
// Just for example, module_send_summary_mail is on a separate
// function (see below)
}
}
function module_send_summary_mail() {
... do the job ...
}More info
README.txt (Full overview)
INSTALL.txt (Installation instructions)
External documentation:
Installation guide, usage instructions and examples @ www.cmswiki.net (ITALIAN Language)
Credits
Elysia cron is a part of the Elysia Community Platform project (but could be used stand alone with no limitation).
Developing is sponsored by Void Labs s.n.c (http://www.void.it)
Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.2 | 2009-Oct-01 | 24.39 KB | Download · Release notes | Recommended for 6.x | |
| 5.x-1.4 | 2009-Oct-01 | 24.3 KB | Download · Release notes | Recommended for 5.x | |
| Development snapshots | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.x-dev | 2009-Oct-01 | 24.39 KB | Download · Release notes | Development snapshot | |
| 5.x-1.x-dev | 2009-Oct-01 | 24.3 KB | Download · Release notes | Development snapshot | |
