Cron job
Also known as: cron task, scheduled cron job
A cron job is a command or script scheduled to run automatically at specific times or intervals on Unix-like systems such as Linux and macOS.
It's handled by a background service called cron and configured in a file called a crontab, using a compact five-part schedule format. Cron jobs run backups, clean up files, send reports, and renew certificates. While cron is simple and reliable, failed jobs often go unnoticed unless someone sets up alerts.
Cron job, explained at three levels
At home
A cron job is like setting a coffee maker's timer. A small helper program called cron runs quietly in the background and checks its schedule every minute. Each line on that schedule says when to run something, such as every night at 2 a.m., and what to do, such as copy your photos to a backup drive. When the time arrives, cron starts the task without anyone pressing a button.
At work
A cron job is a task scheduled to run automatically at set times on Linux or macOS servers, such as every night or every Monday morning. A background service called cron reads the schedule from a file called a crontab and starts each job on time. Businesses care because cron handles backups, reports, and certificate renewals without staff effort, but a failed job can go unnoticed for weeks unless someone monitors it.
At home
Cron is a background service on Linux and Mac systems that wakes up every minute, checks a list of scheduled jobs, and runs any whose time has come. Each line in that list, called a crontab, has five time fields and a command. The fields are minute, hour, day of month, month and day of week, so '0 2 * * *' means minute 0, hour 2, every day, which is 2:00 a.m. daily. An asterisk means 'every'.
At work
Each user has a crontab edited with 'crontab -e', and system jobs live in /etc/crontab and /etc/cron.d. Cron runs jobs with a minimal environment, often a short PATH and no user profile, so scripts that work in your terminal fail silently under cron unless they use full paths. Cron only emails output if mail is configured, so redirect output to logs and alert on failures. Systemd timers are a modern alternative with logging and dependency handling built in.
At home
Cron follows the local clock, which daylight saving time disturbs. When clocks spring forward, the hour from 2:00 to 3:00 does not exist, so jobs scheduled then may not run. When clocks fall back, that hour happens twice, so jobs may run twice. Some cron versions handle this, but not all. In my view, schedule important jobs away from 1 to 3 a.m., or run servers in UTC, which has no time changes at all.
At work
Treat scheduled jobs as production code: document each one, keep crontabs in version control or configuration management, and restrict who can edit them. Monitor with dead man's switch check-ins, where the job pings a monitoring service on success and silence raises an alert. Prevent overlapping runs with lock files such as flock. Attackers often add cron entries to maintain persistence after a break-in, so baseline crontabs and alert on changes.
Real-world examples
At home
Jerome runs a home server. He set a cron job to back up his photos to an external drive every night at 3 a.m.
At work
Nadia manages servers for a Toronto e-commerce firm. A cron job's silent failure stopped backups for weeks, so she added alerts for missed check-ins.
How it compares
| feature | Cron job | Windows Task Scheduler |
|---|---|---|
| Platform | Linux, macOS, Unix | Windows |
| Setup | Text file (crontab) | Graphical app or PowerShell |
| Triggers | Time-based | Time, login, events |
| Built in | Yes | Yes |
Cron schedules tasks on Unix. Task Scheduler does it on Windows.
For analysts
In system documentation, I'd list every scheduled job, its owner, and what happens if it fails. Hidden cron jobs are a classic source of surprise outages.
History & origin
Cron appeared in Version 7 Unix in 1979, written by Ken Thompson, its name derived from 'chronos,' the Greek word for time. Paul Vixie rewrote it in 1987, and 'Vixie cron' became the basis for versions used on many Linux systems. Windows has an equivalent called Task Scheduler. Cloud platforms later offered cron-style schedulers, such as Kubernetes CronJobs and managed schedulers on AWS, Azure, and Google Cloud, and the cron schedule format became a universal language for timing tasks. In my view, cron is a lovely example of a simple tool lasting nearly half a century.