Cron is the standard Unix job scheduler β and despite being decades old, it remains the backbone of automated task scheduling across Linux servers, cloud services like AWS EventBridge, CI/CD pipelines like GitHub Actions, and container orchestrators like Kubernetes. The five-field cron expression syntax looks cryptic at first (0 9 * * 1-5), but with the right mental model it becomes second nature. This guide demystifies it with 20+ real examples.
Advertisement
The 5-Field Cron Format
minute hour day-of-month month day-of-weekEach field can contain a specific value, a range, a list, a step, or a wildcard. * * * * * means "every minute of every hour of every day."
Special Characters Explained
| Char | Name | Meaning | Example |
|---|---|---|---|
| * | Wildcard | Every possible value | * in hour = every hour |
| , | List | Multiple specific values | 1,15 in day = 1st and 15th |
| - | Range | Fromβto (inclusive) | 9-17 in hour = 9 AM to 5 PM |
| / | Step | Every N intervals | */5 in minute = every 5 min |
| ? | No Specific Value | Used in some systems for day fields | ? in day-of-week (Quartz) |
| L | Last | Last day of month or week | L in day = last day of month |
| # | Nth Weekday | The Nth occurrence in the month | 2#1 = first Monday (Quartz) |
| @reboot | Alias | Run once at startup | @reboot (Linux crontab only) |
β¨ Free Cron Expression Generator
Build cron expressions visually β choose your schedule with dropdowns and get the expression automatically. Supports standard Unix cron, Quartz, AWS EventBridge, and more.
Open Cron Generator βAdvertisement
20 Essential Cron Expression Examples
Every X Minutes/Hours
*/5 * * * * # Every 5 minutes
*/15 * * * * # Every 15 minutes
0 * * * * # Every hour (on the hour)
0 */2 * * * # Every 2 hours
0 */6 * * * # Every 6 hours (midnight, 6am, noon, 6pm)Daily Schedules
0 0 * * * # Every day at midnight (00:00)
0 9 * * * # Every day at 9:00 AM
30 17 * * * # Every day at 5:30 PM
0 0,12 * * * # Twice daily: midnight and noonWeekday / Weekend Schedules
0 9 * * 1-5 # Weekdays at 9 AM (MonβFri)
0 9 * * 1 # Every Monday at 9 AM
0 0 * * 0 # Every Sunday at midnight
0 8 * * 6,0 # Saturday and Sunday at 8 AM
0 9-17 * * 1-5 # Every hour 9β5, weekdays onlyMonthly / Specific Dates
0 0 1 * * # 1st day of every month at midnight
0 0 1,15 * * # 1st and 15th of every month
0 0 28-31 * * # Last few days of the month
0 0 * 1 * # Every day in January only
0 0 * */3 * # Every day, every 3rd month (Jan, Apr, Jul, Oct)Practical Real-World Schedules
0 2 * * * # Daily database backup at 2 AM (low traffic)
*/10 9-17 * * 1-5 # Every 10 min during business hours
0 9 * * 1 # Weekly report every Monday morning
0 0 1 1 * # Annual job on Jan 1st at midnight
5 4 * * 0 # Weekly cleanup every Sunday at 4:05 AMPlatform Differences: Linux vs AWS vs GitHub Actions
Linux Crontab (5 fields)
# Edit with: crontab -e
# MIN HOUR DOM MON DOW
0 9 * * 1-5 /path/to/script.sh- Runs in server's local timezone
- 5 fields only (no seconds)
- Supports @reboot, @daily, @weekly aliases
- Output goes to email (set MAILTO= to disable)
AWS EventBridge (6 fields)
# Cron format in EventBridge:
# MIN HOUR DOM MON DOW YEAR
cron(0 9 ? * MON-FRI *)
# Rate expression alternative:
rate(5 minutes)- Always runs in UTC
- 6 fields including year
- Use
?in DOM when DOW is set (and vice versa) - Month/day can use names (JAN, MON)
GitHub Actions
# .github/workflows/schedule.yml
on:
schedule:
- cron: '0 9 * * 1-5'
# UTC only; min interval: 5 min- Always UTC (convert from your local time)
- Minimum interval: 5 minutes
- May delay up to 30 min during high load
- Disabled if no commits for 60 days
Kubernetes CronJob
# manifest.yaml
spec:
schedule: "0 2 * * *"
timeZone: "America/New_York" # K8s 1.27+
jobTemplate:
...- 5 fields, standard cron syntax
- Kubernetes 1.27+: supports timeZone field
- Older: always UTC (set offset manually)
- Set concurrencyPolicy for overlap handling
Common Mistakes to Avoid
* 9 * * *β Right: 0 9 * * *The first field is minutes, not hours. * in minute position = every minute of the 9 AM hour (60 runs), not once at 9 AM.
0 9-17 * * *β Right: 0 9-17 * * 1-5This runs every hour 9β5, including weekends. Add 1-5 in the day-of-week field for weekdays only.
*/60 * * * *β Right: 0 * * * **/60 is invalid (60 > 59 for minutes). Use 0 in the minute field to run on the hour.
0 9 * * 7β Right: 0 9 * * 0Sunday is 0 in standard cron, not 7. Some systems accept both; use 0 for portability.
Quick Reference: Common Schedules
| Schedule | Cron Expression |
|---|---|
| Every minute | * * * * * |
| Every 5 minutes | */5 * * * * |
| Every hour | 0 * * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 9 AM | 0 9 * * * |
| Weekdays at 9 AM | 0 9 * * 1-5 |
| Every Monday at 8 AM | 0 8 * * 1 |
| 1st of every month | 0 0 1 * * |
| Every Sunday at 2 AM | 0 2 * * 0 |
| Every 15 min during 9-5, weekdays | */15 9-17 * * 1-5 |
| Twice a day (noon + midnight) | 0 0,12 * * * |
| Jan 1st at midnight | 0 0 1 1 * |
Tip: Use our Cron Generator to build any expression visually and validate it instantly. It also explains what an existing expression does in plain English.