ProcessCronJobs by Neue Rituale

Manages the execution of CronJobs

The module provides paths under which cronjobs can be registered. It lists all registered cronjobs and can execute individual ones manually. The last execution, the last status and, in the event of an error, the last error message are displayed.

  • Clear overview of all registered CronJobs
  • Easy to set timing (onInit or onReady) and delay (LazyCron)
  • Individual path (endpoint) that executes the CronJobs. Configuration of a secret path segment and additional path segments (namespaces) for selected CronJobs.
  • Display of the time of the last execution and any error messages

  1. Copy the files for this module to /site/modules/ProcessCronJobs/
  2. In admin: Modules > Refresh. Install ProcessCronJobs.
  3. Go to Setup > CronJobs
  4. Copy and Install example Module (modules/ProcessCronJobs/example/ProcessCronJobsRegistration.module.example) to register your CronJobs in the __constructor() method. You can also use any other __constructor() method. It makes sense to register the CronJobs as early as possible so that they can also be executed on onInit.
  5. Set up the real cron that calls the ProcessCronJobs provided endpoint.

  1. Execute the following command in your website root directory.
    composer require nr/processcronjobs

A simple example for registering a CronJob.

wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
		function(CronJob $cron){ echo "Hello Cron"; },

This CronJob should run once a day at init.

wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
		function(CronJob $cron){ echo "What a beautiful day"; },
			'lazyCron' => 'LazyCron::everyDay',
			'timing' => CronJob::timingInit,

This CronJob runs for a very long time and is called directly by a "real" CronJob so as not to block other CronJobs. The endpoint for this CronJob is or

CronJobs that have a namespace (own path segment) cannot be delayed with LazyCron, because LazyCron can only be started by a single request. LazyCron creates a lock file and thus blocks the execution of parallel calls.

wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
		function(CronJob $cron){ echo "I have so much work to do"; },
			'timing' => CronJob::timingInit,
			'ns' => 'longrunning'


Modules > Configure > ProcessCronJobs

You will find the following configuration options in the module settings:

  • The trigger path, i.e. the path that triggers the CronJob processing, can be adjusted here (default: cron/).
  • A secret path segment can be created that must be appended to the trigger path so that processing is started.
  • Automatic processing can generally be stopped (status).
  • The cache of ProcessCronJobs can be emptied. Things like the time of the last call, the status of the last call and possibly an error message are stored in the cache.


nameStringUnique name in PascalCase e.g. MyFirstCronJob.
callbackCallablefunction(CronJob $cron){}Function to be executed
lazyCronnull, StringnullIf empty, the CronJob is executed without delay as soon as the path is called.
nsnull, StringnullIf empty, the CronJob is called via the default path.
timingIntegerCronJob::timingReadyThe CronJon can be called either at onInit (1) or onReady (2). OnInit is earlier and therefore faster, but not all functions of ProcessWire are available here, e.g. page and language.
timingStrStringonReadyThis is just a getter property.
disabledBooleanfalseThis can be used to deactivate the cronjob, e.g. disabled = $config->debug.
triggerIntegerCronJob::triggerNeverDisplays the last trigger for execution. Possible values are:
1 (Never): CronJob has never been executed
2 (Auto): CronJob was last executed directly via the "real" Cron (onDemand).
4 (Lazy): CronJob was called up with a time delay via the LazyCron.
8 (Force): The CronJob was started manually
16 (Error): The last call ended with an error (see log).
triggerStrStringUnknownThis is just a getter property.
lastRunInteger0Contains the last execution time as a Unix timestamp. Stored and retrieved in the ProcessWire cache.
lastErrorStringPossible error message from the last call

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Latest news

  • ProcessWire Weekly #489
    In the 489th issue of ProcessWire Weekly we'll check out what's new in the core this week, share a brand-new recipe of the week, and more. Read on! / 23 September 2023
  • ProcessWire 3.0.226 new main/master version
    After 8 months in development we are excited to bring you ProcessWire 3.0.226 main/master. This version has a ton of great new features, improvements and optimizations, plus more than 100 issue fixes. This post takes an in-depth look at highlights from this great new version.
    Blog / 25 August 2023
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer