Reliable HTTP cron and delayed-job scheduling with automatic retries and full run logs — delay.run
Here's a cron line that looks like it means "9 a.m. on Monday the 1st":
0 9 1 * 1 /usr/local/bin/monthly-report
Enter fullscreen mode
Exit fullscreen mode
It doesn't. It runs at 9 a.m. on the 1st of every month, and at 9 a.m. every Monday. That's about five runs a month instead of one or two a year. Nobody finds out until the report has gone to customers four times.
This is one of the oldest surprises in cron, and it's documented right there in man 5 crontab . Here's the rule, the quirk inside the rule, and recipes for the schedules people usually meant.
The rule
A cron expression has five fields: minute, hour, day of month, month, day of week. Minute, hour and month are combined with AND, as you'd expect. The two day fields are special:
If only one of day-of-month and day-of-week is restricted (the other is * ), the restricted one applies. 0 9 1 * * is the 1st of the month.…