Lesson 1
What Is Cron?
Scheduled jobs and where five-field Unix cron appears.
Cron is a time-based job scheduler. In Unix tradition, a cron expression (or crontab line) tells the system when to run a command or trigger a job—not what the job does.
One line, five decisions
Classic Unix cron uses five fields separated by spaces:
minute hour day-of-month month day-of-week
Example: 0 9 * * 1-5 means “at minute 0, hour 9, every day of the month, every month, on weekdays (Monday–Friday).” In plain language: 09:00 on weekdays.
The job runner evaluates the current time against each field. When all fields match, the job fires.
Where you meet cron
| Context | Typical use |
|---|---|
Linux crontab -e | Log rotation, backups, cache warming |
Kubernetes CronJob | Namespace cleanup, report generation |
GitHub Actions schedule | Nightly builds, dependency scans |
| Managed cloud schedulers | Lambda/EventBridge rules (often with extensions) |
| Application libraries | In-process schedulers inspired by cron syntax |
Not every platform uses identical five-field rules—always read that platform’s docs—but the mental model transfers.
Cron vs interval timers
“Every 5 minutes” can be expressed as */5 * * * * in cron, or as a simple interval timer in code. Cron excels when schedules align to wall-clock boundaries (every day at 02:00, first of month, weekdays at 09:00).
Interval timers excel for “every N seconds from process start.” Pick the tool that matches operational expectations.
Cron does not guarantee exactly-once
Missed runs can happen if the host was down, the previous run overran its window, or concurrency limits blocked a new start. Design jobs to be idempotent and safe if they run twice or skip once.
Key takeaway
Cron expressions are compact schedules. The next lesson breaks down each field’s grammar—*, lists, ranges, and steps—so you can read any line with confidence.