Cron Jobs: Schedules, Overlaps & Missed Runs

Lab
Easy
Medium
Hard

Job slower than the schedule (overlap)Medium

A 7-minute job every 5 minutes: runs pile up in parallel.

Cron expression

*/5
minute
*
hour
*
day of month
*
month
*
day of week

“Every 5 minutes” (UTC)

The job and the scheduler

How long does one run take?7 min
If the previous run is still going…
1 / 1109:00 UTC
Schedule loaded
Cron checks the expression once a minute and fires the job whenever the current time matches. In the next 45 minutes it matches 9 times.

Timeline (45 min from Mon 16 Nov, 09:00 UTC)

09:00
09:05
09:10
09:15
09:20
09:25
09:30
09:35
09:40
09:45
#1
#2
#3
#4
#5
#6
#7
#8
#9
run catch-up run skipped tick missed tickdashed = delayed start (queued)
9
Ran
0
Skipped
0
Missed
2
Peak concurrency
Next 8 runs (UTC)
  1. 1Mon, 16 Nov 2026 09:00:00
  2. 2Mon, 16 Nov 2026 09:05:00
  3. 3Mon, 16 Nov 2026 09:10:00
  4. 4Mon, 16 Nov 2026 09:15:00
  5. 5Mon, 16 Nov 2026 09:20:00
  6. 6Mon, 16 Nov 2026 09:25:00
  7. 7Mon, 16 Nov 2026 09:30:00
  8. 8Mon, 16 Nov 2026 09:35:00
✗ Runs overlap

Two copies of the job run at once. If the job isn't safe to run concurrently (double emails, duplicate charges, locked rows), add a lock or skip-if-running.

Learn the theory

Cron Jobs: Schedules, Overlaps & Missed Runs: how it works

4 min read · Updated

Cron runs commands on a schedule: every night, every five minutes, every Monday at 9. The syntax is tiny — five fields — but production cron jobs fail in predictable ways: a run takes longer than its interval and overlaps itself, the machine is down and the run is missed, or two fields combine in a way nobody expected. This lab shows the schedule, the timeline and the failure modes side by side.

In short

  • A cron expression has 5 fields: minute, hour, day of month, month, day of week.
  • Plain cron only checks the clock once a minute and has no memory: runs during downtime are lost.
  • If a job takes longer than its interval, runs overlap unless you add a lock or skip-if-running policy.
  • When both day-of-month and day-of-week are restricted, cron uses OR, not AND.
  • Cron schedules are in the server's timezone (often UTC), and DST can skip or repeat local times.

The five fields

┌──────── minute        (0–59)
│ ┌────── hour          (0–23)
│ │ ┌──── day of month  (1–31)
│ │ │ ┌── month         (1–12)
│ │ │ │ ┌ day of week   (0–7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *  command
SyntaxMeaningExample
*every value* * * * * every minute
*/nevery n-th value*/5 * * * * every 5 minutes
a-ba range0 9-17 * * * hourly, 9 to 17
a,b,ca list0 8,20 * * * at 08:00 and 20:00
a-b/nrange with a step0-30/10 * * * * minutes 0, 10, 20, 30

The day-of-month / day-of-week trap

If you restrict both day-of-month and day-of-week, standard cron fires when either matches. 0 0 13 * 5 is “midnight on the 13th, or on any Friday” — not “Friday the 13th”. The last preset in the lab prints the real run dates so you can see it.

When a job is slower than its schedule

Cron doesn't know whether the last run finished. A 7-minute job scheduled every 5 minutes starts a second copy before the first ends. Depending on the job, that can double-send emails, double-charge cards, fight over locks or exhaust the database.

PolicyBehaviorUse when
Allow overlapStart every tick regardless.The job is safe to run concurrently.
Skip if runningDrop the tick if the previous run is active (use a lock file, flock, or a DB advisory lock).Work is “latest state wins”, e.g. a sync or cleanup.
QueueRun every tick, one after another.Every tick must be processed. Watch for an ever-growing backlog.
# skip-if-running with flock
*/5 * * * * flock -n /tmp/report.lock /usr/local/bin/build-report

Missed runs and catch-up

Classic cron only evaluates the current minute. If the machine is off, rebooting or the scheduler crashed at 03:00, the 03:00 run never happens and nothing records it. Options:

  • `anacron` (or systemd timers with Persistent=true) run a missed job once when the system comes back.
  • Job schedulers in a database or queue (BullMQ repeatable jobs, Sidekiq, Temporal, Kubernetes CronJobs with startingDeadlineSeconds) persist the schedule.
  • Idempotent jobs that process “everything since last success” make a catch-up trivial and safe.

Timezones and daylight saving time

Cron uses the system timezone unless you configure one. Local-time schedules misbehave around DST: a job at 30 2 * * * may not run on the day clocks jump forward (02:30 doesn't exist) and some implementations run twice when clocks fall back. Most teams schedule in UTC and convert in the UI.

Production checklist

  • Use locks or a queue so runs can't overlap unintentionally.
  • Make jobs idempotent and resumable.
  • Add jitter (a random delay) to avoid every service hammering the database at :00.
  • Log start, end and exit status; alert when a job doesn't run (dead-man's switch).
  • Set timeouts so a hung run can't block the next one forever.
  • Prefer a real job queue when you need retries, backoff or visibility.

Frequently asked questions

What does */5 * * * * mean in cron?
Run every 5 minutes: the minute field */5 means every fifth minute (0, 5, 10 …), and the other fields are wildcards.
What happens if a cron job takes longer than its interval?
Cron starts the next run anyway, so two copies can overlap. Use a lock (flock, advisory lock) or skip-if-running logic if overlap is unsafe.
Does cron run missed jobs after downtime?
No. Standard cron only checks the current minute and keeps no record of missed runs. Use anacron, systemd timers with Persistent=true, or a persistent scheduler to catch up.
Why does my cron expression with a day of month and a weekday run too often?
When both fields are restricted, cron matches if EITHER the day of month OR the day of week matches. It is not an AND.
What timezone does cron use?
The system's timezone (often UTC on servers) unless a CRON_TZ/TZ setting or your scheduler specifies otherwise. DST changes can skip or repeat local-time schedules.
When should I use a job queue instead of cron?
When you need retries with backoff, concurrency control, visibility into failures, or work triggered by events. Keep cron as the trigger that enqueues jobs.

Keep exploring

More interactive labs

All labs

Job Queues with BullMQ (Redis)

Watch jobs move through waiting, active, delayed, completed and failed — and see what BullMQ stores in Redis.

Queues & Jobs14 min · Intermediate

Webhooks: Delivery, Retries & Signatures

Why you get duplicate deliveries, lost events and forged requests — and how to stop them.

Queues & Jobs12 min · Intermediate

JS Event Loop Visualizer

See the call stack, microtasks and timers run, frame by frame.

JavaScript10 min · Intermediate

CORS & Preflight Simulator

Edit the request and the server headers, then see exactly why the browser blocks it.

Networking12 min · Intermediate

HTTP Caching Explained

Cache-Control, ETag and 304s, one request at a time.

Networking12 min · Intermediate

What Happens When You Type a URL

DNS, TCP, TLS and HTTP — with a stopwatch.

Networking10 min · Beginner

How Database Indexes Work (B-Tree)

See a B-tree lookup beat a full table scan, and why some queries ignore your index.

Databases12 min · Intermediate

What Happens When 100 Reads Hit the Database

Connection pools, CPU workers, caches and replicas, as 100 requests arrive at once.

Databases12 min · Intermediate

SQL Isolation Levels Lab

Run two transactions side by side and watch dirty reads, phantoms and write skew appear.

Databases15 min · Advanced

Sharding & Replication

Split data across servers, copy it for reads, and see what each choice costs.

Databases15 min · Advanced

Redis Commands & Data Structures

Strings, lists, hashes, sets and sorted sets, one command at a time.

Redis15 min · Beginner

Redis Caching: Cache-Aside, TTL & Eviction

Hit or miss? Watch LRU, LFU, TTLs and a cache stampede decide your database load.

Redis12 min · Intermediate

RabbitMQ: Exchanges, Queues, Acks & Dead Letters

Direct, topic and fanout routing, competing consumers, prefetch, redelivery and dead-letter queues, drawn.

Queues & Jobs14 min · Intermediate

Git Commands, HEAD & Refs (Visual)

Every core git command drawn with arrows: three areas, commits, branches, HEAD and remotes.

Git15 min · Beginner

Git Merge vs Rebase

Watch the commit graph change under merge, rebase and squash.

Git10 min · Beginner