# Cron Job

A task launched automatically according to a recurring time-based schedule.

- Type: term
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-09-24
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/cron-job/>)

## What it means

A cron job is a command or workload triggered by a scheduler at times expressed with a calendar-like cron schedule. The term comes from Unix cron but is also used for equivalent managed and container-platform schedulers. Scheduling starts an attempt; it does not guarantee the task finishes, runs only once, or starts at an exact instant.

## Why it matters

Cron jobs automate recurring product and operational work such as reports, cleanup, billing cycles, and data synchronization. Their clock-based simplicity hides decisions about time zones, missed runs, overlapping executions, retries, and ownership.

## When to use it

Use a cron job when work should start on a predictable recurring schedule and does not require a user request. Use event-driven triggers when work depends on a state change, and use a workflow system when the task has complex dependencies, long-lived coordination, or strict execution guarantees.

## How it works

1. Define the command, schedule, time zone, owner, inputs, and expected duration.
2. Configure a scheduler with the execution environment and least-privilege credentials.
3. Choose policies for late starts, missed schedules, overlap, retries, and retained history.
4. Make the task idempotent or protect it with an appropriate concurrency control.
5. Record each attempt and alert on missed, failed, stuck, or unexpectedly long runs.

## A practical example

A subscription product schedules a daily entitlement reconciliation at 02:00 UTC. The task records its reporting window, refuses overlapping runs, safely upserts corrections, and alerts if no successful run completes by 04:00.

## Where it breaks

Schedulers can be unavailable, clocks and daylight-saving rules can surprise teams, and a task may overlap or be missed. Cron syntax varies across implementations. Time-based polling can also waste work compared with a direct event trigger.

## Common mistakes

- Assuming the scheduler guarantees exactly-once execution or successful completion.
- Leaving the time zone implicit and mishandling daylight-saving transitions.
- Allowing a slow run to overlap the next one without deliberate concurrency rules.
- Monitoring task errors but not the absence of an expected run.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/cron-job/#visualization-cron-job>)

## Sources

1. [crontab — Schedule Periodic Background Work](<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html>) — The Open Group · Technical standard
2. [CronJob](<https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/>) — Kubernetes · Official technical documentation

## Related topics

- [Background Job](<https://wiki.soroush.uk/topic/background-job/>)
- [Continuous Delivery](<https://wiki.soroush.uk/topic/continuous-delivery/>)
- [Observability](<https://wiki.soroush.uk/topic/observability/>)
