When executed, it checks all component manifests for cron jobs and runs them sequentially. The components are processed in the order they are returned by the component loader, the jobs of a single component are run in the order they are listed in the configuration array.
Cron Job configuration
Each cron job is defined by an associative array containing the following keys:
The Cron service uses customdata section of the manifest, using the key midcom.services.cron as you might have guessed. So, an example cron entry could look like this:
'customdata' => Array ( 'midcom.services.cron' => Array ( Array ( 'handler' => 'net_nehmer_static_cron_test', 'handler_config' => Array ('test', 'configuration', 'entries'), 'recurrence' => MIDCOM_CRON_MINUTE, ) ), ),
A simple (and useless) handler class would look like this:
print_error("Executing..."); $this->print_error(strftime('%x %X')); } } ?>
Cron Job implementation suggestions
You should keep output to stdout to an absolute minimum. Normally, no output whatsoever should be made, as the cron service itself is invoked using some kind of Cron Daemon. Only if you output nothing, no status mail will be generated by cron.
Launching MidCOM Cron from a System Cron
You need to request the midcom-exec-midcom/cron.php page of your website to have cron running. Lynx or the GET command line tools can be used, for example, to retrieve the cron page:
lynx -source http://your.site.com/midcom-exec-midcom/cron.php GET http://your.site.com/midcom-exec-midcom/cron.php
The script produces no output unless anything goes wrong.
At this time, this script does also do a request_sudo to gain Administrator privileges. This is a temporary workaround until we can deal with HTTP authentication at this point.
arrayThe job to execute.
After this call, all required handler classes will be available.
arrayThe job configurations
arrayThe job to register.
See the class introduction for a more precise definition of these keys.
(Services use this facility for example.)
|todo||Factor this out into its own configuration file.|
Set in the constructor