Cron every two weeks
One cron expression cannot say "every two weeks", but a short crontab workaround can. Below: the lines, how they work, what daylight saving does to them, and how to get an alert when the job stops.
0Minute9Hour*Day of month*Month1Day of weekAt 09:00, on Monday.
0 9 * * 1 [ $(( $(date +\%s) / 604800 \% 2 )) -eq 0 ] && /usr/local/bin/job.shHow do you run a job every two weeks with cron?
The line runs every Monday, and the test lets the job through on alternate weeks: it counts whole weeks since 1 January 1970 and checks whether the count is even. Change -eq 0 to -eq 1 to switch weeks.
0 9 * * 1 [ $(( $(date +\%s) / 604800 \% 2 )) -eq 0 ] && /usr/local/bin/job.shWhat does 0 9 * * 1 mean?
At 09:00, on Monday.
| Field | Written | Means |
|---|---|---|
| Minute | 0 | 0 |
| Hour | 9 | 9 |
| Day of month | * | every day of month |
| Month | * | every month |
| Day of week | 1 | Monday |
How often does it run?
On a day it runs, it runs once. It runs on 52 days of 2027, 52 runs in all. Runs are 7 days apart.
- Runs on a day it runs
- 1
- Days it runs in 2027
- 52
- Runs in 2027
- 52
- Shortest gap
- 7 days
When is this schedule useful?
Fortnightly payroll, biweekly sprint reports, and reminders that follow a two-week cycle.
What should you watch out for?
Writing 0 9 */14 * * runs on the 1st, 15th and 29th of each month, not every 14 days. The week-number test keeps a true two-week rhythm.
What happens when the clocks change?
On Sunday 14 March 2027, clocks in America/New_York jump from 02:00 to 03:00. This schedule does not run that day, so the change does not touch it.
On Sunday 1 November 2026, clocks in America/New_York fall back from 02:00 to 01:00, so the hour from 01:00 happens twice. This schedule does not run that day, so the change does not touch it.
A server that keeps its clock on UTC never sees either change. The next run calculator previews any zone.
How do you get an alert when it stops running?
Create a simple check that expects a ping every 14 days, with 5 minutes of grace, then ping it at the end of the job. If a run does not report in by the end of the grace time, CronMissed sends an alert.
0 9 * * 1 [ $(( $(date +\%s) / 604800 \% 2 )) -eq 0 ] && /usr/local/bin/job.sh && curl -fsS --max-time 10 --retry 5 --retry-connrefused -o /dev/null "https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10"The snippet builder writes the same ping for systemd, GitHub Actions, Vercel, Kubernetes and backup scripts.
Questions and answers
- At 09:00, on Monday. On its own it does not give this schedule; the crontab lines on this page add what one expression cannot.
- On a day it runs, it runs once. It runs on 52 days of 2027, 52 runs in all. Runs are 7 days apart.
- Create a simple check that expects a ping every 14 days, with 5 minutes of grace, then add the ping to the end of the job so it requests the check URL after each successful run. If a run does not report in by the end of the grace time, CronMissed alerts you by email, Slack, Discord, Telegram, ntfy or webhook.
What does 0 9 * * 1 mean in cron?
How often does 0 9 * * 1 run?
How do I get an alert when this job stops running?
Know the first time this schedule misses a run
CronMissed expects a ping at every run of 0 9 * * 1. When one is late or reports a failure, you get an alert by email, Slack, Discord, Telegram, ntfy or webhook.