The Five Fields of standard Cron
A standard Unix cron expression consists of five space-separated fields representing the time interval of execution. The scheduler evaluates these fields continuously to determine if a job should trigger.
* * * * *
+--------------------- Minute (0 - 59)
Special Operators
- `*` (Asterisk): Matches any value in the field. For example, `*` in the hour field means 'run every hour'.
- `,` (Comma): Separates a discrete list of values. `1,5` in the hour field means run exactly at 1:00 AM and 5:00 AM.
- `-` (Hyphen): Defines an inclusive range of values. `1-5` in the day-of-week field means Monday through Friday.
- `/` (Slash): Specifies step increments. `*/15` in the minute field means run every 15 minutes (0, 15, 30, 45).
Common Examples
- `0 0 * * *`: Run once a day at midnight.
- `0 2 * * 1-5`: Run at 2:00 AM every weekday.
- `*/5 * * * *`: Run every 5 minutes.
The 'Day of Month' vs 'Day of Week' Conflict
If both the Day of Month and Day of Week fields are restricted (not `*`), the command will execute when *either* field matches. For example, `0 0 13 * 5` runs at midnight on every Friday AND on the 13th of every month, not just on Friday the 13ths.
