This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!
You can configure which cronjob that will be enabled (can be executed by the "runcronjobs.php" script) from within an override for the "settings/cronjob.ini" configuration file. The following list reveals which settings that can be specified in the "[CronjobSettings]" section of this file.
- The ScriptDirectories configuration array specifies the directories where eZ Publish will search for built-in cronjob scripts (the "cronjobs" directory is used by default).
- The ExtensionDirectories directive specifies the extension directories where eZ Publish will search for additional/custom cronjob scripts. By default, eZ Publish will search in the "cronjobs" subdirectory inside your extension(s).
Some cronjobs must be executed more frequently than others. It is possible to configure additional sets of cronjobs by adding specific sections (cronjob parts) to an override for "cronjob.ini".
The next examples demonstrate how the cronjobs can be configured.
The following settings are specified in the "[CronjobSettings]" section of "cronjob.ini" by default:
[CronjobSettings] ScriptDirectories=cronjobs Scripts=unpublish.php Scripts=rssimport.php Scripts=indexcontent.php Scripts=hide.php Scripts=subtreeexpirycleanup.php Scripts=internal_drafts_cleanup.php ExtensionDirectories
This means that the main set of cronjobs contains the following six tasks:
These scripts will be run each time the "runcronjobs.php" script is executed without the "group_of_tasks" option. The system will expect these scripts to be located in the "cronjobs" directory.
The following configuration blocks (cronjob parts) located in the "settings/cronjob.ini" configuration file specify two additional sets of cronjobs called "infrequent" and "frequent":
[CronjobPart-infrequent] Scripts=basket_cleanup.php Scripts=linkcheck.php [CronjobPart-frequent] Scripts=notification.php Scripts=workflow.php
The settings located in the "[CronjobPart-infrequent]" section instruct the system to run the "basket_cleanup.php" and "linkcheck.php" scripts when the "runcronjobs.php" script is executed in the following way:
php runcronjobs.php infrequent
The "frequent" set of tasks only includes the notification and work-flow cronjobs. These scripts will be run when the "runcronjobs.php" script is executed in the following way:
php runcronjobs.php frequent
With this configuration, it is possible to run each set of cronjobs separately, e.g.:
- Workflow.php and notification.php - every 15 minutes.
- The basket cleanup and link check cronjobs - once a week.
- The main set of cronjobs - once a day.
If you wish to run the "old_drafts_cleanup.php" cronjob once a month, you can add the following settings to the "cronjob.ini.append.php" file located in the "settings/siteaccess/example" directory (replace "example" by the actual name of the siteaccess):
The settings located in the "[CronjobPart-monthly]" section will instruct the system to run the "old_drafts_cleanup.php" cronjob script when the "runcronjobs.php" script is executed in the following way:
php runcronjobs.php monthly -s example
It is possible to extend the system by creating custom cronjob scripts. For example, if you have an extension "nExt" that includes a cronjob script "myjob.php", you'll need to put the following lines into an override for the "cronjob.ini" configuration file:
[CronjobSettings] ExtensionDirectories=nExt Scripts=myjob.php
[CronjobSettings] ScriptDirectories=extension/nExt/cronjobs Scripts=myjob.php
These settings will make eZ Publish expect the additional cronjob script to be located at "extension/nExt/cronjobs/myjob.php". This script will be added to the main set of cronjobs and thus it will be run each time the "runcronjobs.php" script is executed without the "group_of_tasks" option.
Svitlana Shatokhina (24/11/2006 12:49 pm)
Ricardo Correia (17/04/2013 4:12 pm)