Understanding 5-Field Standard Cron Syntax
Cron is the time-based job scheduler standard across Linux, Unix, and modern cloud orchestrators (Kubernetes CronJobs, AWS EventBridge, GitHub Actions, and Azure Functions). A standard cron expression consists of 5 whitespace-separated fields:
┌───────────── minute (0 - 59)
│ ┌────────────── hour (0 - 23)
│ │ ┌─────────────── day of the month (1 - 31)
│ │ │ ┌──────────────── month (1 - 12)
│ │ │ │ ┌───────────────── day of the week (0 - 6) (0 to 6 are Sunday to Saturday)
│ │ │ │ │
* * * * *
Special Characters & Modifiers
*(Asterisk): Matches any allowed value for that field (e.g.*in hour means "every hour").,(Comma): Specifies a list of discrete values (e.g.1,15,30in minute means "at minutes 1, 15, and 30").-(Hyphen): Specifies an inclusive range of values (e.g.1-5in day of week means "Monday through Friday")./(Slash): Specifies step intervals (e.g.*/10in minute means "every 10 minutes", or0 */6 * * *means "every 6 hours starting at midnight").
Common Production Cron Pitfalls
- 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 condition matches (OR logic).
- Server Timezone Mismatch: Cloud container clusters run on UTC by default. If your office is in UTC+5 (PKT) or UTC-5 (EST), schedule adjustments are required to align with local business hours.
- Overlapping Executions: If a scheduled task takes 10 minutes to run but triggers every 5 minutes, worker threads will pile up, creating deadlocks and CPU starvation. Always configure lockouts (e.g.
READPAST, Redis distributed lock, or single-instance mutexes).