Cron Expression Mastery: From Simple Intervals to Complex Schedules
A masterclass in crafting, debugging, and parsing cron expressions: understanding 5 vs 6 field syntax, step values, and daylight saving pitfalls.
Marcus Chen
Full-Stack Engineer
Scheduling automated background jobs, database backups, and recurring data pipelines is a fundamental responsibility of backend and DevOps engineers. Yet, despite decades of standard usage, cron syntax remains one of the most frequently misconfigured specifications in software engineering, often leading to unexpected outages or duplicate job executions.
The Anatomical Breakdown of a 5-Field Cron Expression
A standard POSIX cron string contains five fields separated by whitespace:
* * * * *
│ │ │ │ │
│ │ │ │ └─ Day of Week (0 - 6, Sunday to Saturday)
│ │ │ └─── Month of Year (1 - 12)
│ │ └───── Day of Month (1 - 31)
│ └─────── Hour of Day (0 - 23)
└───────── Minute of Hour (0 - 59)
Common Traps and Special Operators
- The Step Operator (
/):*/15 * * * *executes every 15 minutes, whereas0 */2 * * *triggers every two hours at minute zero. - Comma vs. Range:
0 9,17 * * 1-5schedules tasks at 9:00 AM and 5:00 PM Monday through Friday. - Day of Month vs. Day of Week: In standard cron, if both day-of-month and day-of-week are specified, the command executes when either field matches, not both.
- Daylight Saving Time (DST) Jumps: Jobs scheduled between 2:00 AM and 3:00 AM can execute twice or be skipped entirely during clock adjustments unless servers run strictly on UTC.
Frequently Asked Questions
What is the difference between a 5-field and 6-field cron expression?
Standard Linux cron uses 5 fields (minute to day-of-week), while Quartz and AWS EventBridge schedules often add a 6th field at the beginning for second-level precision.
Why should all server cron jobs run in UTC?
Running server clocks in UTC eliminates ambiguities caused by regional daylight saving time transitions and simplifies multi-region database replication schedules.
Conclusion
Never deploy untested cron strings to production servers. Build, inspect, and translate your schedules into plain English using our client-side Cron Expression Builder and verify execution times with our Epoch Converter.
Enjoyed this read?
Get monthly updates on privacy engineering and web performance straight to your inbox.