The cronjob scripts
The cronjobs/ directory of the installation holds the kernel's cronjob scripts. Each file is a short entry point; the code is in kernel/private/classes/cronjobs/. The table lists every shipped script, the part that runs it in a new installation, and what it needs. ./console list cron and Setup > Cronjobs show the same descriptions, and the scripts of active extensions as well.
| Script | What it does | Part as shipped |
|---|---|---|
| unpublish.php | Moves objects to the trash when their unpublish_date has passed | global |
| hide.php | Hides nodes whose hide date has passed | global |
| indexcontent.php | Indexes content whose indexing was delayed | global |
| rssimport.php | Fetches the RSS imports set up under Setup > RSS and publishes new items | global |
| internal_drafts_cleanup.php | Removes internal drafts (versions created but never edited) | global |
| notification.php | Sends notification mail to subscribed users | frequent |
| workflow.php | Continues workflows that wait for the cronjob (approval and others) | frequent |
| contentjobs.php | Resumes content jobs whose worker died, starts queued ones | frequent |
| datatablesync.php | Runs the data table synchronisations that are due | frequent |
| audit.php | Audit trail: sink spools and alert rules; once a day rotation, archives and checkpoints | frequent |
| mailbounces.php | Reads the bounce mailbox (does nothing until it is set up) | frequent |
| graphqlwebhooks.php | Sends GraphQL webhook events (does nothing until one is configured) | frequent |
| basket_cleanup.php | Removes abandoned shopping baskets | infrequent |
| linkcheck.php | Checks the links stored in the URL table | infrequent |
| mailpreferences.php | Retention of the e-mail preferences data | infrequent |
| usersessions.php | Ends unused signed-in sessions, removes ended ones | infrequent |
| useraudit.php | Removes old rows of the user audit log | infrequent |
| exphelp.php | Help maintained as content: removes old feedback answers | infrequent |
| clusterpurge.php | Purges expired entries of a database cluster | cluster_maintenance |
| unlock.php | Releases content objects stuck in a locked state | unlock |
| cachecleanup.php, httpcache_cleanup.php, querycache_cleanup.php | Remove expired view cache, cache-block, HTTP cache and query cache files | cache_cleanup |
| cleanuprss.php | Trims what the RSS import created (does nothing until configured) | cleanuprss |
| explogrotate.php | Rotates the logs over their maximum size | logs |
| contentcheck.php, migrationpush.php, staticpublish.php | Content checks index, migration pushes, static publishing | parts of their own |
| old_drafts_cleanup.php | Removes old drafts | none |
| trashpurge.php | Purges the trash | none |
| session_gc.php | Removes expired sessions from the session store | none |
| subtreeexpirycleanup.php | Removes expired subtree_expiry cache blocks | none |
| staticcache_cleanup.php | Removes expired entries of the static cache | none |
| updateviewcount.php | Counts page views from the web server's access log | none |
"Parts of their own" and "none" mean that no default schedule runs the script: add it to a part the site runs (see Configuring cronjobs), or run its part with php runcronjobs.php <part>.
Hiding and unpublishing on a date
hide.php hides the nodes of the classes in content.ini [HideSettings] HideDateAttributeList[] (class identifier as key, the identifier of a date and time attribute as value) below the nodes of RootNodeList[], once that date has passed. It hides them as Hide in the administration does, and tells the search engine.
# settings/override/content.ini.append.php [HideSettings] RootNodeList[] RootNodeList[]=2 HideDateAttributeList[] HideDateAttributeList[article]=hide_date
unpublish.php moves objects to the trash once the date in their attribute unpublish_date has passed (the attribute identifier is fixed), for the class IDs in [UnpublishSettings] ClassList[] below the nodes of RootNodeList[]:
[UnpublishSettings] RootNodeList[] RootNodeList[]=2 ClassList[] ClassList[]=16 # the ID of the class, for example article
Add a Date and time attribute with the identifier you named to the class first, under Setup > Classes.
Delayed indexing
With site.ini [SearchSettings] DelayedIndexing=enabled, publishing does not index the object at once; indexcontent.php indexes it later. DelayedIndexingClassList[] limits the delay to some classes. Without delayed indexing the script finds nothing to do.
Drafts
Both draft scripts read content.ini [VersionManagement]. old_drafts_cleanup.php removes drafts older than DraftsDuration[] (90 days as shipped), at most DraftsCleanUpLimit (100) per run. internal_drafts_cleanup.php removes internal drafts older than InternalDraftsDuration[] (1 day), at most InternalDraftsCleanUpLimit (100) per run.
The trash
trashpurge.php purges the trash for good: everything, or with content.ini [TrashSettings] KeepItemsForDays only what has been in the trash for that many days. bin/php/trashpurge.php does the same from a shell with --trashed-days=<days>.
Checking links
linkcheck.php checks the addresses of the URL table (the links of rich text and of URL attributes, listed under Setup > Link management) and marks each one valid or invalid. http, https and ftp addresses are requested, mailto addresses are valid when their domain has a mail server, links to content are checked against the content, file addresses are not tested, and a path is looked up as a path of the site on the addresses of [linkCheckSettings] SiteURL[]. Addresses on private networks are never requested unless listed in AllowedPrivateHosts[].
# settings/override/cronjob.ini.append.php [linkCheckSettings] SiteURL[] SiteURL[]=https://www.example.com SiteURL[]=https://www.example.com/admin # seconds before a link is checked again, and the time one run may take RecheckInterval=72000 MaxRunTime=900
The server must be allowed to make outgoing HTTP and HTTPS requests. The group also has Timeout, ConnectTimeout, MaxRedirects, HostDelay, MaxURLsPerRun and UserAgent.
Shopping baskets
basket_cleanup.php works while site.ini [Session] BasketCleanup=cronjob (the shipped value); it removes baskets idle for longer than BasketCleanupIdleTime, using BasketCleanupTime, BasketCleanupAverageFrequency and BasketCleanupFetchLimit from the same group.
Page views from the access log
updateviewcount.php reads the web server's access log and counts the views of each node, which the view_top_list fetch function lists. Set the log in logfile.ini:
# settings/override/logfile.ini.append.php [AccessLogFileSettings] StorageDir=/var/log/httpd LogFileName=access_log
./console exp:expviewcountupdate does the same from a shell, for one siteaccess or several.
Workflows and notifications
workflow.php continues the workflow processes that wait for the cronjob, for example a publication held for approval by the Approve event. notification.php sends the notification mail of the subscriptions users made. Run both often: the frequent part does.
Cache blocks with subtree expiry
With site.ini [TemplateSettings] DelayedCacheBlockCleanup=enabled, expired cache-block caches with the subtree_expiry parameter are not removed when content is published; subtreeexpirycleanup.php removes them later.
Scripts that were removed
- ldapusermanage.php synchronized users with an LDAP server in the 4.x releases. It is not shipped with Exponential 6; the LDAP login handler updates a user's data at every sign-in.
- clusterbinarypurge.php purged a database cluster in the 4.x releases. Its successor is clusterpurge.php in the part cluster_maintenance: php runcronjobs.php cluster_maintenance.
More
- Cronjobs: running, scheduling and following them.
- The cronjob scripts, generated from their code.
Contributors
- Svitlana Shatokhina Commenter
- Ricardo Correia Maintainer
- Geir Arne Waaler Maintainer
- Andrea Melo Maintainer
- Mauro Commenter
- Ludmillia Commenter
- Ronan Commenter
- Graham Brookins Updated Maintainer
Comments (4 historical)
Written by readers of the earlier documentation sites, kept as they were.
Manual link validation
Mauro ·
It will be very useful in the admin interface (setup - URL management) the possibility of manually check the validity of a single link.
use of the SitePrefix INI setting
Svitlana Shatokhina ·
You may need to add an escaped slash at the end of a siteaccess name:
See http://issues.ez.no/9559 for more information.
EZ FLOW Cronjob
Ludmillia ·
How can I configure cronjob.ini for EZ FLOW ?
Taking care of updateviewcount needed file in a cronjob log strategy
Ronan ·
If you enable the update view count cronjob,
and if /var/log/httpd/mywebsite.log is missing,
and if you log your cronjobs using php runcronjob.php ... >> mycronjobs.log
update view count script will raise a warning message in your mycronjobs.log file, as it'll try to fetch the missing /var/log/httpd/mywebsite.log file