By Productivities Team • Riyadh, Saudi Arabia
Cron Expressions Demystified: Schedule Like a Pro
Cron is the Unix/Linux task scheduler that has been automating system administration tasks since 1975. Today, cron expressions are used far beyond Unix — they schedule jobs in Kubernetes, AWS CloudWatch, GitHub Actions, CI/CD pipelines, and countless backend frameworks. Understanding cron syntax is essential for any developer working with automated tasks.
The Five Fields of Cron
A standard cron expression consists of five fields separated by spaces:
┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *
Special Characters
*— matches every value ("every minute," "every hour," etc.),— lists multiple values:1,15means "1st and 15th"-— defines ranges:9-17means "9 AM through 5 PM"/— defines steps:*/5means "every 5 units"
Common Cron Patterns
0 * * * *— Every hour, on the hour0 9 * * 1-5— Every weekday at 9:00 AM0 0 * * *— Midnight every day0 0 1 * *— Midnight on the 1st of every month*/15 * * * *— Every 15 minutes0 9,17 * * *— At 9 AM and 5 PM daily
Cron in Modern Infrastructure
Beyond traditional Unix crontabs, cron expressions power scheduled tasks across the modern tech stack. AWS EventBridge uses a 6-field cron with a year field. Kubernetes CronJobs use standard 5-field syntax. GitHub Actions uses cron in workflow triggers. Understanding the syntax once lets you schedule tasks everywhere.
Common Pitfalls
- Timezone confusion — Cron defaults to the server's timezone. Always document which timezone your cron uses.
- Overlapping runs — If a job takes longer than the interval, you might get multiple instances running simultaneously.
- Day-of-month + day-of-week — When both are specified, cron runs when either matches (OR logic), not both (AND logic).
Test your cron expressions with our Cron Explainer — see the next run times and human-readable descriptions instantly.
Share this article
Try the tool mentioned in this article
Cron Explainer