Skip to content
The Job Record
step 1/5

Reading — step 1 of 5

Read

~1 min readJob Queue & Execution

The Job Record

A scheduled job is the tuple (id, cron, command, last_run, next_run, status).

{
  "id":         "backup-db",
  "cron":       "0 3 * * *",          # 3am daily
  "command":    "/usr/bin/pg_dump -U app prod > /backup/$(date +%F).sql",
  "last_run":   "2025-03-16T03:00:00Z",
  "next_run":   "2025-03-17T03:00:00Z",
  "status":     "idle",                # idle | running | failed
  "max_overlap": 1                     # don't allow more than 1 concurrent run
}

Persisting these to disk (sqlite, JSON file) lets the scheduler recover after restart. Recompute next_run from last_run, not from now(), so a crashed scheduler doesn't permanently shift the schedule forward.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…