BackendBench
Coffee

Home โ€บ Cron errors โ€บ Crontab

Crontab ยท error

crontab error: bad day-of-week

crontab: installing new crontab
"/tmp/crontab.xxxx":1: bad day-of-week
errors in crontab file, can't install.

Why this happens

Day-of-week is 0-7 in crontab, where both 0 and 7 are Sunday. 8 is out of range.

Wrong and right

wrong
0 0 * * 8

Our parser says: dow value 8 is out of range (0-7)

fixed
0 0 * * 1

At 00:00 UTC, on Mon. First runs after 1 Jan 2027 (UTC): Mon 04 Jan, 00:00, Mon 11 Jan, 00:00, Mon 18 Jan, 00:00, Mon 25 Jan, 00:00, Mon 01 Feb, 00:00

How to fix it

  1. Use 1-5 for Monday to Friday and 0 or 7 for Sunday.
  2. Or use names: MON-FRI.
  3. Remember that Quartz numbers differently if you are copying from a Java project.

The Crontab format at a glance

Fields in order: minute (0-59), hour (0-23), day-of-month (1-31), month (1-12), day-of-week (0-7, 0 and 7 = Sunday).

Cron runs in the server's local time zone. Check it with the date command, or put CRON_TZ=Asia/Kolkata above the line on cronie-based systems.

The fixed schedule in other systems

If you are moving this schedule to another scheduler, these are the equivalents of 0 0 * * 1:

SystemExpression
Quartz0 0 0 ? * 2
Spring0 0 0 * * 1
Kubernetes0 0 * * 1
AWS EventBridge0 0 ? * 2 *
Jenkins0 0 * * 1
GitHub Actions0 0 * * 1
node-cron0 0 * * 1
Apache Airflow0 0 * * 1
Azure Functions0 0 0 * * 1
Google Cloud Scheduler0 0 * * 1

Try it yourself

The tester below starts with the fixed expression. Change it and watch the schedule update.

Your week at a glance
fewer more runs

Upcoming runs

#LocalUTCFrom now

Copy-ready code

Frequently asked questions

Is 7 allowed?

Yes, as Sunday, in most crontab implementations (not in GitHub Actions).

More Crontab fixes

See the full Crontab cron builder or convert between formats.

More tools you might need