Glossary

What Is a Cron Job? Cron Syntax Explained

Cron is a Unix-based job scheduler that runs commands or scripts automatically at specified times and intervals. A cron job is a scheduled task defined by a cron expression — a concise syntax specifying when the command should execute. Cron is fundamental to DevOps, server maintenance, data pipelines, and batch processing.

The Cron Expression Format

A standard cron expression has five fields: minute (0–59), hour (0–23), day of month (1–31), month (1–12), day of week (0–7, where 0 and 7 are Sunday). Each field accepts a number, * (any), a range (1-5), a list (1,3,5), or a step value (*/15 = every 15). Example: 30 9 * * 1-5 runs at 9:30 AM on weekdays.

Common Cron Patterns

Every minute: * * * * *. Every hour at :30: 30 * * * *. Daily at midnight: 0 0 * * *. Daily at 9 AM: 0 9 * * *. Every Monday at 8 AM: 0 8 * * 1. First day of month at midnight: 0 0 1 * *. Every 5 minutes: */5 * * * *. Every weekday at noon: 0 12 * * 1-5.

Cron Special Keywords

Many cron implementations support shorthand: @reboot (once at startup), @yearly or @annually (0 0 1 1 *), @monthly (0 0 1 * *), @weekly (0 0 * * 0), @daily or @midnight (0 0 * * *), @hourly (0 * * * *). These are more readable than bare numbers for common schedules.

Timezone Considerations

Cron runs in the server's local timezone by default, which can cause issues when servers use UTC and business logic needs local time. Many modern schedulers (Kubernetes CronJob, GitHub Actions, AWS EventBridge) allow explicit timezone specification. Always document the timezone assumption in your cron job configuration.