What it is
cron is the time-based job scheduler built into Unix and Linux. A crontab file lists commands with five time fields, minute, hour, day of month, month and day of week, and the cron daemon runs each command when its time comes round. It needs no extra software and has been part of Unix systems for decades.
Because it is so simple, cron is still the default way to run routine server work: backups, cleanups, report generation, renewals and checks. Its limits are just as simple. It does not retry failed jobs or report on them by itself, so good cron jobs log what they did and raise an alert when they fail.
How I use it
- Cron jobs on the Rental Pilot server run billing checks, reminders and health probes.
- Automated billing and asset cron jobs are installed through CodeDeploy, so staging matches production exactly.
- The schedule ships with the code, so no server carries jobs that exist only on that machine.
- Every production system is also probed every five minutes from outside, and an outage reaches my phone.
cron is the right tool when a job has to run on a schedule on a server you already operate. I reach for it for the unglamorous parts of business software, like billing checks and reminders, and I install the jobs through the deploy pipeline so no server has a schedule that exists only on that machine.
Questions
How do you keep scheduled jobs the same in staging and production?
Rental Pilot's cron jobs are installed through CodeDeploy as part of each deploy, so the schedule comes from the code, not from someone editing a server by hand.
What kind of jobs does Rental Pilot run on a schedule?
Billing checks, reminders and health probes run as cron jobs on the server.