Periodic command scheduling


Structr provides a service for periodic command scheduling: the CronService.

The CronService is a background service that can be configured in the structr.conf configuration file to schedule the execution of periodic tasks. Tasks in this context are either names of schema methods, or fully qualified Java class names of a class implementing the Task interface from the Structr Java API.

The main configuration key for tasks is CronService.tasks. It accepts a whitespace-separated list of schema method names or java class names.

CronService.tasks = cleanUpMethod1 org.structr.example.PeriodicExampleTask exampleMethod

For each of the entries in the above line, you can configure an execution time and date.

# Run every 30 minutes
cleanUpMethod1.cronExpression = 0 0,30 * * * *

# Run every day at 4:00
org.structr.example.PeriodicExampleTask.cronExpression = 0 0 4 * * *

# Run each hour on Mondays during the first 10 days in April and October
exampleMethod.cronExpression = 0 0 * 1-10 4,10 1

Structr will then run the specified tasks with the configured frequency as the admin user.


About this article
Last change 2017-02-24