Spring Cron syntax

Cron is a software utility that specifies commands to run on a given schedule. This schedule is defined by a Cron pattern, which has a specific syntax that will be described in this section.

Warning If you create an invalid Cron pattern, Collibra Data Intelligence Platform stops responding.

Note By default, Collibra Console uses Spring Cron expressions to schedule back-ups, while you use Quartz Cron expressions, for example, to schedule your mail, LDAP synchronizations, Purge cycles, Tableau and S3 synchronizations or to create a statistics cron map.

The Cron pattern consists of six space-separated fields:

<second> <minute> <hour> <day of month> <month> <day of week>

Position

Field

Allowed values Allowed special characters

Examples

1

second 0-59 , - * /
  • 10: at the 10th second.
  • */10: every 10 seconds.

2

minute 0-59 , - * /
  • 30: at the 30th minute.
  • */15: every 15 minutes.
  • 5/10: every 10 minutes starting at the 5th minute after the hour

3

hour 0-23 , - * /
  • 10: at 10 o'clock.
  • 8-10: at 8,9 and 10 AM.
  • 6,18: at 6 AM and at 6 PM.

4

day of the month 1-31 , - * ? / L W
  • 3: on the 3rd day of the month.
  • 1-4: every first four days of the month.
  • 1,15: the first day of the month and the 15th day of the month.

5

month 1-12 or JAN-DEC , - * /
  • 12: in December.
  • 1-3: every first three months of the year.
  • JUL,AUG: every July and August.

Tip The names of the months are not case-sensitive.

6

day of the week

0-7 or MON-SUN where 0 and 7 is Sunday.

, - * ? / L #
  • TUE: every Tuesday.
  • 1-5: every weekday, Monday to Friday.
  • MON,WED,FRI: every Monday, Wednesday and Friday.
  • L: only in combination with a digit or short day notation indicating the last day of the month. For example, 7L or SUNL indicates the last Sunday of the month, 3L or WEDL indicates the last Wednesday of the month.
  • 5#3: on the 3rd Friday of the month.

Tip The names of the days are not case-sensitive.

For more information, see the Spring Cron documentation.

Special characters

Character Description
*

Used to select all values within a field.

Example * in the minute field corresponds with every minute.

?

Used to specify something in one of the two fields in which the character is allowed, but not the other, mainly used for days of the week.

Example If you want your trigger to fire on a particular day of the month, for example the 10th, but don't care what day of the week that happens to be, you could put "10" in the day-of-month field, and "?" in the day of the week field.

-

Used to specify ranges.

Example 10-12 in the hour field means “the hours 10, 11 and 12”.

,

Used to specify additional values.

Example MON,WED,FRI in the day-of-week field means “the days Monday, Wednesday, and Friday”.

/

Used to specify increments.

Example  0/15 in the seconds field means “the seconds 0, 15, 30, and 45”. And 5/15 in the seconds field means “the seconds 5, 20, 35, and 50".
You can also leave out the number before /, which is equivalent to having 0 before / .
1/3 in the day-of-month field means “fire every 3 days starting on the first day of the month”.

L

The value L in the day-of-month field means “the last day of the month” - day 31 for January, day 28 for February on non-leap years. You can also specify an offset from the last day of the month, such as “L-3” which would mean the third-to-last day of the calendar month.

You cannot use L in the day-of-week field by itself, you always have to prefix it by a digit (0-7) or the short day notation (MON-SUN). This combination means “the last xxx day of the month” - for example “6L” or "SATL" means “the last Saturday of the month”.

W

Used to specify the weekday (Monday-Friday) nearest the given day.

Example  15W in the value for the day-of-month field, means the nearest weekday to the 15th of the month:

  • If the 15th is a Saturday, the trigger will fire on Friday the 14th.
  • If the 15th is a Sunday, the trigger will fire on Monday the 16th.
  • If the 15th is a Tuesday, then it will fire on Tuesday the 15th.

However if you specify 1W as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not ‘jump’ over the boundary of a month’s days. The ‘W’ character can only be specified when the value in the day-of-month field specifies a single day, not a range or list of days.

Tip The 'L' and 'W' characters can also be combined in the day-of-month field to yield 'LW', which translates to *"last weekday of the month"*.

#

Used to specify “the nth” XXX day of the month.

Example 6#3 in the day-of-week field means “the third Saturday of the month” (day 6 = Friday and “#3” = the 3rd one in the month).
Other examples: 2#1 is the first Tuesday of the month and 4#5 is the fifth Thursday of the month. Note that if you specify #5 and there is not 5 of the given day-of-week in the month, then no firing will occur that month.

Example 
  • 0 0 * * * * = the top of every hour of every day.
  • */10 * * * * * = every ten seconds.
  • 0 0 8-10 * * * = 8, 9 and 10 o'clock of every day.
  • 0 0 6,19 * * * = 6:00 AM and 7:00 PM every day.
  • 0 0/30 8-10 * * * = 8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day.
  • 0 0 9-17 * * MON-FRI= on the hour nine-to-five weekdays.
  • 0 0 0 25 12 ?= every Christmas Day at midnight, no matter what weekday it is.