Pseudocron jobs

How jobs are triggered

Individual cron tasks are managed by the Jomres Pseudocron functionality. This functionality manages task schedules and decides which cron tasks should be called. These tasks are stored in the q43qy_jomcomp_cron table, who's contents will look like this.

pseudocron table

 

You can view the tasks via the Administrator > Jomres > Settings > Site Configuration page, Cron tab.

On this page you will see a "Method" setting, which determines how the cron process is triggered. If it's left to the default setting of Minicomponent, then whenever Jomres itself is viewed in the CMS, then a background task is fired to asynchronously call the Jomres Cron functionality. This ensures that the actual Jomres task being called is not slowed down by the background tasks that are run, however it means that if your Jomres page isn't called for some time, for example an hour, then tasks that need to be performed more often, say every quarter hour, are not run at that time.

To resolve that, you setup cron jobs to either call the Jomres Cron functionality, or you can call individual tasks as cron jobs. An example of how to setup a cron task to call Jomres is given next to the setting.

pseudocron method setting

How to run some jobs more often

On that tab, if you scroll down, you will see the jobs from the database.

cron jobs list

These jobs are presented as links, and if you click on one of those links, the scheduled task will be run.

There is no output presented on the page, instead it will open in a new tab then a blank screen is shown.

 

A link to the review reminder task would be similar to

http://www.domain.com/index.php?option=com_jomres&no_html=1&jrajax=1&Itemid=0&lang=en&task=cron_review_reminder

 

If you need certain tasks to be run more often, for example pulling an ical .ics file from a remote site, you can then setup individual cron jobs to call specific tasks like this :

curl -s http://www.domain.com/index.php?option=com_jomres&no_html=1&jrajax=1&Itemid=0&lang=en&task=cron_ical_process_remote_feeds > /dev/null

 

Developer notes

The purpose of this page is to give the Jomres plugin developer a brief overview of how to install and create pseudocron jobs for Jomres.

In brief

Jomres supports a pseudo cron system, IE a system that works a bit like timed jobs in linux (cron). Cron jobs are called on a timed basis depending on how the cron job was installed (this cannot be changed at a later time, except by manually editing a table).

Installation of a cron job

As a plugin developer, you will want to tell Jomres that there are scripts you want to call on a timed basis. You do this in the plugin_install.php of your plugin. An example can be seen on the Creating plugins page.


jr_import('jomres_cron');
$cron = new jomres_cron($displayLog);
$cron->addJob("dummy_third_party_plugin","M","");


This functionality "registers" the cron job with the pseudocron functionality, and the intervals are as follows.

"M": // Every minute 

"QH": // Every quarter hour

"H": // Every hour

"D": // Every day

"W": // Every week

The cron job file itself

A cron job file is just like any other 06000 task, ie it can be called by anybody, assuming that the menu linking to Jomres allows unregistered users to view it.

Conclusion

That's it. It's very simple. Create a 06000 task that "does stuff", then use ''addJob'' in ''plugin_install.php'' to tell Jomres to call it from time to time.