How Cron Scheduling Works
In modern operating systems and cloud platforms, continuous polling loops and arbitrary sleep timers waste computing resources. Instead, a background scheduler daemon (crond) remains dormant and wakes up at the beginning of each minute.
A Cron scheduler evaluates the current date and time against the fields defined by the expression and runs the associated command when the schedule matches.
The 5 Standard Unix/Linux Cron Fields
Standard Unix and Linux crontab expressions consist of 5 space-delimited fields evaluated from left to right:
| Field Order | Field Name | Allowed Values | Special Characters |
|---|---|---|---|
| 1 | Minute | 0 - 59 | * , - / |
| 2 | Hour | 0 - 23 (24-hour) | * , - / |
| 3 | Day of Month | 1 - 31 | * , - / |
| 4 | Month | 1 - 12 or JAN - DEC | * , - / |
| 5 | Day of Week | 0 - 7 or SUN - SAT (0 & 7 = Sun) | * , - / |
Special Characters and Wildcards
Represents all possible values in that field. For example, * in the hour field matches every hour from 0 through 23.
Specifies multiple discrete values. For example, 1,15,30 in the minute field triggers at minutes 1, 15, and 30.
Defines an inclusive range of numbers. For example, 9-17 in the hour field matches hours 9 through 17 inclusive.
Specifies increments within a field or range. For example, */15 in the minute field runs every 15 minutes (:00, :15, :30, :45).
Ecosystem Dialects & Differences
While standard Linux crontab employs 5 fields, different software frameworks use variations:
- Linux / Unix Cron: Standard 5 fields (minute to day-of-week).
- Spring Boot (@Scheduled): 6 fields, adding second precision at index 0 (
sec min hr dom mon dow). - Quartz Scheduler: 6 or 7 fields (
sec min hr dom mon dow [year]), requiring the?token in either DOM or DOW. - Jenkins Pipeline: 5 fields with support for the Jenkins-specific
H(hash) token to distribute node load. - AWS EventBridge: 6 fields with mandatory year field (
cron(min hr dom mon dow yr)) orrate()expressions.