Cron schedule
- Standard term
A cron schedule is a repeating timetable, written as minute, hour, day, month, and weekday settings, that starts a job automatically whenever the clock matches, such as every Sunday at 6 p.m.
A program called the “scheduler” wakes, usually once a minute, and compares the time with its list of patterns. It reads the clock in whatever time zone it was set to, which on a rented computer elsewhere may not be yours. It runs only while the computer is awake, so minutes that pass during sleep are never compared.
Where you’ll meet it
An agent on your laptop posts the family's week ahead to your group chat every Sunday at 6 p.m. This Sunday nothing came. The laptop was closed in your bag at six, and when you opened it at nine, the agent stayed quiet.
What to do
Plain cron has no setting for catching up, so both options mean a new scheduler. If a late post is fine, have the agent move the job to one that runs missed jobs on waking, such as your laptop's built-in one. If the post must arrive on time, have it moved to a hosted scheduler on an always-on computer.
Easy to mix up
| Cron schedule | Webhook |
|---|---|
| Yes, it runs on time with or without work | No, it waits for another service to report news |
Check yourself
Your agent backs up your files at 2:30 a.m. every night, by your local clock. On the spring night when daylight saving time begins where you live, what can happen to that backup?
Go deeperNewer schedulers patch cron's gaps in different ways
The name comes from cron, a scheduling program from the late 1970s in Unix, the operating system whose design Linux and macOS follow. In its notation, “30 7 * * 1-5” means 7:30 a.m. on weekdays, with each asterisk meaning “any” and “1-5” meaning Monday through Friday.
Anacron was written for machines that are often off. It keeps a note of each job's last run and runs an overdue one once the machine is back. Hosted schedulers often read patterns in UTC, the world's reference time, which moves a 6 p.m. job to a different local hour when the clocks change.
Nothing in the pattern stops a second run from starting while the first is still going. Long jobs take a lock, a marker saying a run is in progress, so the next one waits or exits.