flashman
← All posts

Cron day-of-month and weekday OR semantics

Prevent cron runs by checking day-of-month and weekday OR semantics, platform differences, timezones, and previewed schedules before production deploys.

2026-08-26 · 5 min read · Rahul Chitturi

  • cron
  • scheduling
  • production

A schedule such as 0 9 1 * 1 looks like the first Monday of each month, but many cron implementations run it on the first day of the month and every Monday. When both day-of-month and day-of-week are restricted, classic cron commonly treats them as alternatives.

That one detail can multiply billing jobs, reports, or cleanup tasks. Cloud schedulers and orchestration platforms may use different dialects, so a familiar five-field expression is not enough evidence.

Translate the schedule into plain language

Write the intended calendar rule before editing the expression. Then preview enough future runs to cross month boundaries and compare them with that sentence.

  • Confirm whether the platform uses OR or AND for the two day fields
  • Check whether weekday values use 0, 1, or names for Sunday
  • Verify timezone and daylight-saving behavior
  • Look for six-field dialects that add seconds

Model complex calendar rules explicitly

If the scheduler cannot express first Monday safely, run on every plausible day and put the exact calendar check inside an idempotent job. Alternatively, use a scheduler with explicit calendar syntax.

Whichever approach you choose, protect side effects with a stable execution key. A corrected expression cannot prevent every retry, overlap, or manual rerun.

A Flashman workflow

Use the cron tool to preview run times, the timestamp converter to verify UTC boundaries, the diff tool to review schedule changes, and the JSON formatter for scheduler configuration.

Attach the next ten expected runs and the plain-language rule to the deployment review so the schedule is testable.

Try these tools