fjordtools / Errors / crontab: bad day-of-week

crontab: bad day-of-week (errors in crontab file, can't install)

One of the date fields of the cron line holds a value that is out of range or in the wrong form. Day of week is 0 to 7, month is 1 to 12, day of month is 1 to 31, and names must be the three-letter form such as MON or JAN. Full names like MONDAY are rejected.

Fjordtools team · Seen in Vixie cron · Published · 1 min read

How browsers word it

Vixie cron"-":1: bad day-of-week
Vixie cron"-":1: bad month
Vixie cron"-":1: bad day-of-month

Common causes

  1. A weekday above 7

    Weekdays run from 0 (Sunday) to 7 (also Sunday). Some people count Monday as 1 and stop at 7, which works, but 8 does not.

    Input

    0 0 * * 8

    Cron Explainer says

    dow must be between 0 and 7
  2. A full weekday name

    Names must be the three-letter abbreviations.

    Input

    0 0 * * MONDAY

    Cron Explainer says

    "MONDAY" is not valid for dow
  3. A full month name

    The same rule applies to months: JAN, not JANUARY.

    Input

    0 0 * JANUARY *

    Cron Explainer says

    "JANUARY" is not valid for month
  4. A day of month above 31

    Days of the month run from 1 to 31. Day 0 is not valid either.

    Input

    0 0 32 * *

    Cron Explainer says

    dom must be between 1 and 31

How to fix it

  1. Use 0 to 7 for weekdays, 1 to 12 for months and 1 to 31 for days, or the three-letter names MON and JAN.
  2. Count the fields: minute, hour, day of month, month, weekday, in that order.
  3. Run the line through the cron explainer: it names the field that is wrong.
  4. Remember that a month with fewer days, such as 31 in April, never runs.

Related errors

More error explainers are coming

See all errors.