A CRON expression is a string consisting of six or seven subexpressions (fields), separated by white space, that describe individual details of the schedule.
A very useful tool that enables users to schedule tasks to run periodically at a specified date/time in the future, thus allowing the automation of a lot of tasks and processes that otherwise would require human intervention or another type of coordination.
Basics
The order of the six fields in Azure is:
`{second} {minute} {hour} {day} {month} {day of the week} { year (optional)}`.
Examples
A CRON expression that can be used as a trigger that executes every three minutes looks like: 0 */3 * * * *
.
Or a CRON expression that executes “at minute 5 past every hour from 4 through 7 in February and March”, looks like: `5 4-7 * 2,3 *` (details).
Special character | Meaning | Example |
---|---|---|
* | Selects every value in a field | An asterisk “*” in the day of the week field means every day. |
, | Separates items in a list | A comma “1,3” in the day of the week field means just Mondays (day 1) and Wednesdays (day 3). |
– | Specifies a range | A hyphen “10-12” in the hour field means a range that includes the hours 10, 11, and 12. |
/ | Specifies an increment | A slash “*/10” in the minutes field means an increment of every 10 minutes. |
Tools
CRONTab Guru
In my opinion, the best tool out there to write and validate your cron schedule expressions: