What is a cron job?
Short answer
A cron job is a command scheduled to run automatically at fixed times or intervals, defined by a five-field cron expression (minute, hour, day of month, month, day of week). Cron is the time-based job scheduler on Unix-like systems.
What cron does
Cron is a scheduler on Unix-like systems that runs commands at specified times without anyone triggering them. Each scheduled command is a cron job, and the timing is written as a five-field expression. For the field-by-field syntax, see cron syntax explained.
The five fields
* * * * * command
| | | | |
| | | | +-- day of week (0-6, Sun=0)
| | | +---- month (1-12)
| | +------ day of month (1-31)
| +-------- hour (0-23)
+---------- minute (0-59)Common examples
0 * * * *— at the top of every hour*/15 * * * *— every 15 minutes0 9 * * 1-5— 9:00 on weekdays0 0 1 * *— midnight on the first of each month