DevTools Logo

Cron to Systemd Timer Converter

Cron to Systemd Timer Converter

Translate crontab lines to OnCalendar and back, with next-run proof.

Runs in your browser
Try an example

Input

minute hour dom month dow [command]

Enter a schedule to convert.

Translation & units

No translation yet

Enter a cron or OnCalendar expression, or load an example.

Convert cron's five fields into systemd OnCalendar expressions and back, with names, ranges and steps supported on both sides. The tool models cron's day-of-month / day-of-week OR rule with two OnCalendar lines, normalizes Sunday 0/7, and expands next run times independently from each syntax so you can verify the translation row by row. It also emits a complete .timer and .service unit pair with Persistent, RandomizedDelaySec and the original command preserved.

Examples

Every 15 minutes

Input
*/15 * * * *
Output
OnCalendar=*-*-* *:00/15:00

The minute step maps directly; both previews list the same quarter-hour slots.

Weekday backup

Input
0 4 * * 1-5
Output
OnCalendar=Mon..Fri *-*-* 04:00:00

Weekend runs are skipped in both syntaxes, which the next-run table demonstrates.

The OR case

Input
0 0 13 * 5
Output
OnCalendar=*-*-13 00:00:00 + OnCalendar=Fri *-*-* 00:00:00

Cron fires on the 13th OR any Friday; a single OnCalendar line cannot express that union.

About this tool

Migrating a crontab to systemd timers fails in subtle ways: cron accepts day 0 and day 7 as Sunday, its day-of-month and day-of-week fields combine with OR semantics when both are restricted, and OnCalendar expresses repeats, ranges and weekdays with a completely different grammar. This converter models those traps rather than doing a text substitution, then lists the next five runs from both syntaxes so the equivalence is visible, not assumed.

Paste a five-field cron line — with *, lists, ranges, steps and English month/weekday names — and get an OnCalendar expression suitable for a .timer unit. The reverse direction parses OnCalendar back into cron, warns when seconds or a year restriction cannot be represented, and offers the nearest-minute interpretation. Both directions compute next run times independently from their own parsed schedule.

A unit emitter turns the result into a complete foo.timer and foo.service pair: OnCalendar lines, Persistent toggle, RandomizedDelaySec, Unit reference, and the original command preserved verbatim in ExecStart. Paste a whole crontab for batch conversion, edit the reference time to inspect a different window, and copy or download any artifact.

What this tool does not do

  • crontab syntax varies across implementations (Vixie, BusyBox, cronie); this converter follows the common Vixie behavior for DOM/DOW OR.
  • Previews use UTC for deterministic comparison; real timers expand in local time with DST transitions that are not simulated here.
  • OnCalendar features without cron equivalents — seconds, year restrictions, randomized ~ times — are reported as advisory notes rather than silently dropped.

How to use this tool

  1. Pick a direction

    Choose cron → systemd or systemd → cron with the labeled radio group.

  2. Enter a schedule

    Paste a five-field cron line or an OnCalendar expression; names, ranges and steps are supported.

  3. Verify the preview

    Compare the next five runs column by column; matches mean both parsers agree.

  4. Emit units

    Set the unit name, command, Persistent and delay options, then copy the .timer or .service file.

Use cases

Fleet migrations

Translate crontabs from many hosts and inspect next-run tables before rolling out timer units.

Container hosts

Replace host-level cron entries with timers while preserving the original command in the service unit.

Reverse auditing

Paste an existing OnCalendar expression to see what cron schedule it corresponds to and where precision is lost.

Cron field to OnCalendar mapping

CronOnCalendar
*/15 in minute*:00/15:00
0 4 * * **-*-* 04:00:00
1-5 in weekdayMon..Fri
0 or 7 in weekdaySun
13 in DOM + 5 in DOWtwo OnCalendar lines
Named months*-01,07-01

Previews are evaluated in UTC for determinism; systemd expands calendar events in local time, so check DST behavior for your host.

Common mistakes

Mistake:Translating a restricted DOM and DOW into a single OnCalendar line.

Fix:Vixie cron uses OR when both are restricted; emit two OnCalendar lines so either day triggers the job.

Mistake:Assuming cron weekday 7 means Saturday.

Fix:Both 0 and 7 mean Sunday in cron. The converter normalizes 7 to Sun and notes it.

Mistake:Expecting a timer with seconds precision to map exactly to cron.

Fix:Cron only has minute resolution. The reverse direction warns and offers the nearest-minute interpretation.

Frequently asked questions

Why do cron's day-of-month and day-of-week combine as OR?

In Vixie-style cron, when both the day-of-month and day-of-week fields are restricted (not *), a job runs if either field matches. For 0 0 13 * 5 that means the 13th of the month OR any Friday. A single OnCalendar expression cannot express that union, so the converter emits two OnCalendar lines — one for each calendar rule — inside the same timer unit.

Is cron day 0 or 7 Sunday?

Both. Cron accepts 0 and 7 (and the name sun) as Sunday. The converter normalizes 7 to Sun in the generated OnCalendar weekday expression and notes the normalization so you can verify it.

What does 00/15 mean in OnCalendar?

It is a repeat: start at minute 00 and repeat every 15 units, giving 00, 15, 30 and 45. In a full time expression, *:00/15:00 means every quarter-hour of every hour. Cron's */15 maps to it directly.

How do I express the 13th of the month, or any Friday?

With two OnCalendar lines: OnCalendar=*-*-13 00:00:00 and OnCalendar=Fri *-*-* 00:00:00. systemd timers allow multiple OnCalendar lines and fire when any of them matches, which reconstructs cron's OR semantics exactly.

Should I set Persistent=true?

Persistent=true makes the timer run once at boot if the scheduled time was missed while the machine was off — a good match for cron-like maintenance jobs such as backups. Leave it off for jobs that should only run while the host is awake, like interactive reminders. The unit emitter includes the toggle and explains it in the emitted file.

Why do the next-run previews say UTC?

Browser environments do not expose the server's timezone database, so previews are computed in UTC to be deterministic and comparable between both syntaxes. Your systemd host expands calendar events in local time; review DST transitions for schedules that land near a clock change.

References & standards