ENES

Cron job

A command a computer runs on its own on a schedule, like every night at 3 a.m.

A clock at 3:00 triggers a crontab line that runs a backup script, and it runs again every day

Cron is a scheduler that has come with Unix-like systems since the 1970s. Its job is to run commands at set times. Each scheduled task is a cron job: back up the database every night, send a report every Monday, clean out old files every hour. The list of jobs lives in a file called the crontab.

Every job has a schedule written as five fields: minute, hour, day of the month, month and day of the week. An asterisk means "any". So 0 3 * * * means "at minute 0 of hour 3, every day", and */15 * * * * means every fifteen minutes. The notation is compact and famously easy to get wrong, so people often check it with an online tool before saving.

The idea outlived the tool. Cloud schedulers, Kubernetes, GitHub Actions and many hosting platforms let you schedule tasks with the same cron syntax. Two classic traps: the schedule runs in the server's time zone, which may not be yours, and a failed cron job makes no noise unless someone set up logs or alerts to notice.

Keep in mind

Go deeper

Related terms

More in Software