Skip to content

cron-parser: "first Monday of every month" CAN be expressed in standard cron #2

Description

@dhs-rec

Hi,

The page states:

If you want "first Monday of every month" you cannot express it in standard cron — you need Quartz's 2#1 syntax, or you have to add a wrapper script that exits unless date +%d is between 1 and 7.

This is not quite accurate. Debian's (ISC) cron can do this, although it's not documented. The trick is to combine a day-of-month range with step syntax in the day-of-week field, like

0 1 1-7 * */7

for "first Sunday of each month". If changed to

0 1 1-7 * 7

it means indeed "Every Sunday, plus the 1st to 7th day of each month".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions