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

Scheduled tasks: cronjobs

The Exponential counterpart of Laravel's scheduler, Symfony Scheduler, Celery beat, whenever and Spring's @Scheduled - cronjob parts in cronjob.ini run by runcronjobs.php from the system crontab, the shipped parts the…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/web-framework-developers/scheduled-tasks-and-cronjobs.md

On this page

Scheduled tasks: cronjobs

This page is for developers who declare scheduled tasks in code ($schedule->command()->hourly(), #[AsCronTask], Celery beat, @Scheduled). In Exponential, scheduled work is grouped into cronjob parts declared in settings/cronjob.ini; the system's crontab runs php runcronjobs.php <part> at the rhythm each part needs. The schedule itself lives in the crontab, not in code (Cronjobs for applications).

Contents

  1. Parts and scripts
  2. Parts the site needs
  3. Adding your part
  4. Running and scheduling
  5. Locks, pauses and watching
  6. Compared with other frameworks

Parts and scripts

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

eZRunCronjobs (kernel/classes/ezruncronjobs.php) runs a script; the code of a kernel part is an Exponential\Runnable\CronjobPart class in kernel/private/classes/cronjobs/ (Cronjobs).

Parts the site needs

Shipped parts include frequent (notification, workflow, content jobs, audit) and infrequent (basket cleanup, link check, mail preferences), among others. Without frequent, notifications are not sent and content waiting in a deferred workflow never publishes. Schedule them in every installation (Cronjobs guide).

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). A part of your own can be scheduled separately from the kernel's.

Running and scheduling

php runcronjobs.php --list --allow-root-user
php runcronjobs.php -s site expdemo --allow-root-user
php bin/php/console cron:expdemo -s site
*/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. -s <siteaccess> matters when your extension is active only in some siteaccesses. Setup > Cronjobs proposes crontab lines.

Locks, pauses and watching

  • Only one instance of a cronjob script runs at a time; MaxScriptExecutionTime lets a new instance take over a stuck one.
  • Parts can be paused in Setup > Cronjobs; a paused part is skipped whoever starts it (Pausing cronjob parts).
  • Setup > Cronjobs shows each part, its last runs, output and issues (Cronjobs console).
  • Make scripts safe to run twice and to be interrupted.

Velocity has a scheduler of its own for handlers of its application layer; it does not run Exponential's cronjob scripts, so keep the system crontab for them (Velocity scheduler).

Compared with other frameworks

FrameworkConceptExponential
Laravelschedule:run every minute, schedule in codeone crontab line per part, parts in INI
SymfonyScheduler component, recurring messagescronjob parts; recurring jobs can enqueue expqueue jobs
Django, Celerymanagement commands from cron, Celery beatcronjob parts
Railswhenever, Solid Queue recurring taskscronjob parts
Spring@Scheduledcronjob parts

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