Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Definition of the AEM Sitemap Scheduler cron-like Expression

Avatar

Employee

Hi all, 

 

I'm trying to fully understand the cron-like expression for the AEM Sitemap Scheduler configuration.

 

On this page https://experienceleague.adobe.com/en/docs/experience-manager-learn/sites/seo/sitemaps#sitemap-sched... there is an example of:

 

"0 0 2 1/1 * ? *"

 

So trying to understand this documented example from left to right:

0 (first): Minute 0

0 (second): Hour 0, so together with the first 0 that means MIDNIGHT

2: Only run on the 2nd of the month

1/1: Every month - but why use 1/1 and not * here?

*: Any day of the week

?: I guess this means every year, but why not use * here?

* (last one): what is this for?

 

So in summary I'd like to understand why 1/1 and ? where used instead of *?

And what is that last * for?

 

Many thanks,

 

David

1 Accepted Solution

Avatar

Correct answer by
Level 10

hi @bosschaert, this expression schedules the job to run every day at 2:00 AM

The cron-like expression used in AEM's Sitemap Scheduler configuration follows the Quartz Scheduler format.

Field-by-field Explanation:

  • Seconds (0): The job triggers at the 0th second.

  • Minutes (0): The job triggers at the 0th minute.

  • Hours (2): The job triggers at 2 AM.

  • Day of Month (1/1): The job triggers every day (the 1/1 means start at day 1 and repeat every 1 day).

  • Month (*): The job triggers every month.

  • Day of Week (?): No specific value; used when the day of the month is specified to avoid conflicts.

  • Year (*): The job triggers every year.

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

hi @bosschaert, this expression schedules the job to run every day at 2:00 AM

The cron-like expression used in AEM's Sitemap Scheduler configuration follows the Quartz Scheduler format.

Field-by-field Explanation:

  • Seconds (0): The job triggers at the 0th second.

  • Minutes (0): The job triggers at the 0th minute.

  • Hours (2): The job triggers at 2 AM.

  • Day of Month (1/1): The job triggers every day (the 1/1 means start at day 1 and repeat every 1 day).

  • Month (*): The job triggers every month.

  • Day of Week (?): No specific value; used when the day of the month is specified to avoid conflicts.

  • Year (*): The job triggers every year.

Avatar

Employee

Hi @giuseppebag thanks for the reply.

 

Ah so the first element is seconds rather than minutes - the documentation in https://experienceleague.adobe.com/en/docs/experience-manager-learn/sites/seo/sitemaps#sitemap-sched... links to https://cron.help/ which has minutes as the first element - so that documentation needs to be updated.

 

I found the https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html page with some info on the format and some explanation of ?, but still don't understand why 1/1 was specified instead of *?

 

Kind regards,

 

David

 

Avatar

Level 10

For the month format, 1/1 is equivalent to *, which can be seen as a personal preference. The format X/Y can be helpful for defining different occurrences. For example, 3/2 can mean "every 2nd month starting in March," or in specific terms.

Avatar

Employee

Let's break down the cron-like expression for the AEM Sitemap Scheduler:

Expression:
0 0 2 1/1 * ? *

Parts, left to right:

  1. 0 (minute): At minute 0
  2. 0 (hour): At hour 0 (midnight)
  3. 2 (day of month): On the second day of the month only
  4. 1/1 (month): Every month (see explanation below)
  5. * (day of week): Every day of the week
  6. ? (day of week, but see explanation below)
  7. * (year): Any year

Now to your specific questions:


Why use 1/1 instead of * in the month field?

  • 1/1 means "start with month 1 (January), run every 1 month"—so it is equivalent to using "*" for "every month."
  • Some cron systems (Quartz, which AEM OSGi Scheduler is based on) support interval syntax, and 1/1 is commonly used for clarity or future-proofing (like changing to 2/3 for "every 3 months starting from February").
  • Both "*" and "1/1" effectively mean "every month" in this context. Using 1/1 can sometimes help with readability or documentation, but functionally they're the same here.

Why use ? instead of * in the day of week field?

  • In Quartz cron expressions, ? means "no specific value" and is used as a placeholder. It is needed when another field (like 'day of month') is specified.
  • In standard cron, you can use "*" for both day of month and day of week. But Quartz (used by AEM) only allows one of these to be specific; the other must be "?" to avoid ambiguity.
  • Here, since "2" is specified for the day of the month, you must use "?" in the day-of-week field to mean "no specific value."

What is the last * for?

  • The final "*" is the (optional) "year" field, which means "every year." This field is used in Quartz but not in standard Unix cron syntax.
  • "*" means "every year" (i.e., do not restrict by year).

Quick summary of the AEM (Quartz-based) cron fields:

  1. Minute (0-59)
  2. Hour (0-23)
  3. Day of month (1-31)
  4. Month (1-12 or JAN-DEC)
  5. Day of week (1-7 or SUN-SAT)
  6. ? (special value for 'no specific value', used to avoid collision between day-of-month and day-of-week)
  7. Year (optional)

Example meaning:

  • "0 0 2 1/1 * ? *"
    "At 00:00 on day 2 of every month, every year."

TL;DR("Too Long; Didn't Read.):

  • 1/1 in "month" means every month; "*" is usually fine, but 1/1 shows "every 1 month from January".
  • ? in "day of week" is required by Quartz cron when "day of month" is used.
  • Last * is for "year," meaning all years.

Avatar

Employee

This answer is wrong in this context. The first argument is seconds as @giuseppebag  correctly explained. Also you mention day-of-the week in 2 positions which is never correct.

Avatar

Community Advisor

Hi @bosschaert ,

Expression Breakdown: 0 0 2 1/1 * ? *

What this Means in Practice:

Minute (0): The job triggers at the start of the hour exactly when the clock hits 00 minutes.

Hour (0): This triggers at midnight at the very beginning of the day.

Day of the Month (2): This means it runs only on the 2nd day of each month. So, it won’t trigger on the 1st or any other day only on the 2nd.

Month (1/1): The 1/1 means every month, starting from January. I’ve found this to be commonly used when you want to explicitly state that the job will run every month. It’s the same as using *, but using 1/1 can clarify intent (especially for those who might want to adjust it in the future, like changing it to 3/2 for "every 2nd month starting in March").

Day of Week (*): This wildcard means it doesn’t matter what day of the week it is the job will run on the 2nd of the month regardless of the day.

Day of Week (?): Here, we use ? to avoid ambiguity. When specifying the day of the month, we need to use ? in the day of the week field.

Year (*): This means the job runs every year no specific restriction on which year.

Why 1/1 and ?:

  - The 1/1 in the month field is functionally the same as * but is often used for clarity. This way, it’s explicit that the task is meant to run every month starting from January.

The ? in the day of week field is required because we’ve already specified the day of the month.   - In Quartz, you can’t have both a day of the month and day of the week specified without conflict, so one must be ?.

The Last * (Year):

  - This is for specifying that the job will run every year, as the year field is optional in Quartz cron expressions. It’s just there to ensure the job isn't limited to a particular year.

Note:
While this expression will indeed schedule the job to run on the 2nd of every month at midnight, you’ll need to adjust it based on your specific use case. For example, if you want it to run on a different date, you just modify the day of the month (e.g., change the 2 to a 15 for the 15th). It’s all about customizing it based on when and how often you need the job to trigger.

Regards,
Amit

Avatar

Employee

This answer is wrong in this context. The first argument is seconds as @giuseppebag  correctly explained. Also you mention day-of-the week in 2 positions which is never correct.