Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,155 of 9,155 pages
About the help in other languages
All help pages

Cronjobs for applications

Run an application's periodic work with cronjob parts - how parts and scripts are defined in cronjob.ini, running them with runcronjobs.php and the console, the crontab, siteaccess flags, pausing, locks and monitoring…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/creators/app-creators/cronjobs-for-applications.md

On this page

Cronjobs for applications

This page is for application creators whose application has periodic work: imports, reminders, cleanups, reports. Exponential runs such work as cronjob parts: named groups of scripts that the system crontab starts. The administrator's guide is Cronjobs.

Contents

  1. Parts and scripts
  2. Adding your part
  3. Running parts
  4. The crontab
  5. Locks, pauses and time limits
  6. Watching them

Parts and scripts

settings/cronjob.ini:

BlockHolds
[CronjobSettings] Scripts[]the global part (run when no part is named)
[CronjobSettings] ExtensionDirectories[]extensions that have a cronjobs/ directory
[CronjobPart-<name>] Scripts[]a named part

Shipped parts include frequent (notification, workflow, content jobs, audit), infrequent (basket cleanup, link check, mail preferences), contentjobs, audit, unlock, cleanuprss and cache_cleanup (Commands: cronjob parts).

Adding your part

# extension/expdemo/settings/cronjob.ini.append.php
<?php /* #?ini charset="utf-8"?
[CronjobSettings]
ExtensionDirectories[]=expdemo

[CronjobPart-expdemo]
Scripts[]=expdemo_import.php
*/ ?>

The script lives in extension/expdemo/cronjobs/expdemo_import.php (Writing a cronjob script). Add it to an existing part only when it is quick and has the same rhythm; a part of your own can be scheduled separately.

Running parts

php runcronjobs.php --list --allow-root-user
php runcronjobs.php -s site expdemo --allow-root-user
php runcronjobs.php -s site --script=expdemo_import.php --allow-root-user
php bin/php/console cron:expdemo -s site

-s <siteaccess> matters when your extension is active only in some siteaccesses (ActiveAccessExtensions[]): the script is not found otherwise.

The crontab

*/5 * * * *  cd /path/to/installation && php runcronjobs.php -q -s site frequent >> var/log/cron-frequent.log 2>&1
15  * * * *  cd /path/to/installation && php runcronjobs.php -q -s site expdemo >> var/log/cron-expdemo.log 2>&1

Run as the web server's user, never as root. php bin/php/console crontab:list shows the current crontab; Setup > Cronjobs proposes lines (12. Scheduling with the crontab).

Locks, pauses and time limits

  • Only one instance of a cronjob script runs at a time. MaxScriptExecutionTime (default 43200 seconds) lets a new instance take over a stuck one; set it per part for long jobs.
  • Parts can be paused in Setup > Cronjobs ([PauseSettings] Pause=enabled); a paused part is skipped whoever starts it (Pausing cronjob parts).
  • Make scripts safe to re-run: a crashed run is followed by another.

Watching them

Setup > Cronjobs shows each part, its last runs, output and issues, and whether the crontab schedules it (Cronjobs console). Write clear output lines; they are what an administrator reads when something fails.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x