Ad space (728×90)

systemd Timer (OnCalendar) Explainer

Free systemd OnCalendar= expression parser. Preview the next 5 run times for a systemd timer schedule, including named shortcuts like daily and weekly.

← Back to all tools

Why weekday and date combine with AND, not OR — the opposite of cron

This is the single biggest gotcha for anyone coming from cron: in a systemd OnCalendar expression, a weekday constraint and a date constraint that appear together both have to be true for a match — `Mon *-*-01` means "the 1st of the month, and only if that happens to fall on a Monday," which fires roughly once every seven months, not every Monday plus every 1st. Cron's equivalent situation (restricting both day-of-month and day-of-week) uses OR semantics instead, which is exactly backwards from OnCalendar and is a well-known source of confusion for anyone translating a schedule from one system to the other. Getting this backwards produces a timer that fires far less often than intended, silently, with no error — exactly the kind of mistake worth catching with a preview before deploying a real timer unit.

Why the "~" days-before-end-of-month syntax isn't supported

systemd's calendar syntax allows expressing a date relative to the end of a month — `*-02~03` means "3 days before the end of February" — which requires knowing how many days a given month actually has, including leap-year February. That's a fundamentally different kind of calculation from the range/list/step arithmetic this tool otherwise handles, since it depends on variable, calendar-specific month lengths rather than fixed numeric ranges. Rather than implement that separately and risk getting leap-year edge cases wrong, this tool reports an explicit error for that syntax so it's clear the expression wasn't silently mishandled — it's a scope boundary, not a parsing failure.