PatternCron

Weekend mornings

Saturday-and-Sunday-only jobs, like a weekend digest email: fires at 10:00, and stays completely silent Monday through Friday.

Last updated

Pattern
0 10 * * 6,0
Open in Crontab Schedule Creator

In plain English

  • Fires at 10:00 on Saturday and Sunday
  • Silent Monday through Friday

Why it’s written this way

The day-of-week field takes a comma list, 6,0 — Saturday and Sunday — while day-of-month stays *, so nothing else about the date matters. Minute 0, hour 10 pin the time itself to 10:00.

Cron accepts Sunday as both 0 and 7; this expression uses 0, but 6,7 would mean exactly the same two days. Either is correct — the point is to pick one convention and stay consistent across a codebase.

Edge cases to know

  • →Because day-of-month is left as *, day-of-week alone decides the days. If day-of-month were ALSO restricted, cron would OR the two fields together instead of intersecting them, which is rarely the intent.
  • →A weekend-only job is easy to forget about during on-call rotations that assume 'daily' cadence for everything — document the gap explicitly rather than relying on someone noticing the 6,0.
  • →Public holidays that fall midweek aren't covered by this schedule and never will be — cron has no calendar awareness beyond weekday number and date.

Part by part

0 10
Ten in the morning exactly — late enough that a weekend job does not wake anyone, early enough that a failure is noticed during the day.
* *
Day-of-month and month unrestricted, which keeps the schedule weekly rather than tied to dates.
6,0
A list, not a range: Saturday is 6 and Sunday is 0. Because the week wraps, the weekend cannot be written as a contiguous range at all.

Common mistakes

  • 0 10 * * 6-0

    A range from 6 to 0 is backwards and does not wrap, so cron either rejects it or interprets it in a way that is not the weekend. The list form exists precisely for values that straddle the end of the field.

    0 10 * * 6,0
  • 0 10 * * 0,6

    Identical in behaviour, and worth knowing it is — the order in a list carries no meaning. Writing Saturday first simply reads more naturally as "the weekend".

  • 0 10 * * SAT,SUN

    Readable and less portable: day names work in Vixie cron and not in every scheduler that accepts cron syntax. They also cannot be combined with a step in some implementations.

Questions

Why can the weekend not be a range?

Because the field runs 0 to 6 with Sunday at the start, so Saturday and Sunday sit at opposite ends. Ranges do not wrap around, which makes the two-value list the only correct form.

Does @weekly do this?

No — @weekly is midnight on Sunday only, a single run rather than two. The shorthands cover common cases and none of them expresses a weekend.

What if my weekend is Friday and Saturday?

Then it is 5,6, and the same reasoning applies — it happens to be contiguous, so 5-6 also works. Worth a comment either way, since a reader elsewhere will assume the Saturday-Sunday convention.

Will anyone see it fail?

That is the real weakness of a weekend schedule. Route failures somewhere monitored rather than to mail, or the first anyone knows is Monday — with two runs already missed.

Related in Patterns