Skip to content

AEM Cron Expression Generator for the Sling Scheduler (Quartz)

Build or check a Quartz cron expression for an AEM scheduled task: the schedule in plain English, the next run times, and the OSGi, Runnable and Sling Job code.

Written in December 2026 and checked against the Apache Sling scheduler documentation, the Quartz CronTrigger tutorial and Adobe's Cloud Service development guidelines.

AEM schedules work with Quartz cron expressions: six or seven fields, and the first one is seconds. Build one below or paste one you have. You get the schedule in plain English, the next eight run times and the code that registers it. It all runs in your browser.

Times in the tool are shown in your browser's zone or in UTC. The server reads the expression in its own JVM time zone, so check that zone before you pick an hour.

What do the seven fields mean?

The fields, in the order the Sling scheduler reads them:

#FieldValuesSpecial characters
1Seconds0–59, - * /
2Minutes0–59, - * /
3Hours0–23, - * /
4Day of month1–31, - * ? / L W
5Month1–12 or JAN–DEC, - * /
6Day of week1–7 or SUN–SAT, - * ? / L #
7Year (optional)1970–2099, - * /

L is the last day of the month, or with a weekday the last such weekday (6L). 15W is the weekday nearest the 15th, LW the last weekday of the month, and 6#3 the third Friday. 0/15 in the minutes field means 0, 15, 30 and 45.

Why won't my Unix crontab line work?

Three differences break a line copied from a Linux crontab:

  • Seconds come first. 0 2 * * * has five fields; Quartz wants 0 0 2 * * ?. In Quartz the first field "always indicates the second (not the minute)," as the Sling scheduler documentation puts it.
  • One of the two day fields must be ?. Quartz doesn't support a day of month and a day of week together, so 0 0 2 * * MON fails and 0 0 2 ? * MON works.
  • Day numbers move by one. Unix counts Sunday as 0; Quartz counts it as 1, which is why L alone in the day-of-week field means Saturday, day 7. Day names (MON-FRI) avoid the problem.

Paste a five-field line into the tool and it offers the Quartz version.

What should you use on AEM as a Cloud Service?

A scheduled Sling Job. Adobe rules the Commons Scheduler out in its Cloud Service development guidelines: "Do not use the Sling Commons Scheduler for scheduling, as execution cannot be guaranteed." Cloud Service instances can be recycled at any time, and the same guidelines give Sling Jobs an at-least-once guarantee: a job interrupted mid-run is run again.

The JobManager snippet schedules a job on a topic. A JobConsumer registered for the same topic does the work. Schedule the job once (for example, from a component that checks jobManager.getScheduledJobs() first), or each start adds another copy.

What about AEM 6.5?

On AEM 6.5, a Runnable registered as an OSGi service with a scheduler.expression property is picked up by the Sling Commons Scheduler (the Runnable snippet). Two more properties matter:

  • scheduler.concurrent: Sling lets runs of the same job overlap unless you set it to false. A job that can run longer than its interval needs it.
  • scheduler.runOn: LEADER or SINGLE limits the job to one instance. The scheduler keeps its queue in memory only (see the Sling scheduler documentation), so a leader-only job scheduled on an instance that isn't the leader never runs.

Put the expression in an OSGi configuration rather than in code, so each environment can have its own schedule. The .cfg.json snippet is that configuration, in a file named after the component's PID.

More in Tools

  • Oak Index Definition Generator

    Paste an XPath, JCR-SQL2 or QueryBuilder query and get the Lucene index for it, as diff.json for Cloud Service or .content.xml for 6.5.

  • Dispatcher Filter Tester

    Paste /filter rules and a list of URLs to see which requests get through, which rule decides, and how each URL is split.