Tools / Cron ↔ systemd Timer / K8s CronJob

Cron ↔ systemd Timer / K8s CronJob.

Convert a crontab schedule into a systemd timer and a Kubernetes CronJob, or an OnCalendar back to cron.

Runs in your browser

Five-field cron or @daily-style macro, or a systemd OnCalendar value such as Mon..Fri *-*-* 09:00:00.

Used for the unit files and the CronJob (lowercase, hyphens, at most 52 characters).

Optional IANA name. Empty means the host or cluster default.

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Schedule
systemd .timer
systemd .service
Kubernetes CronJob
crontab line

About Cron ↔ systemd Timer / K8s CronJob

This converter moves a schedule between the three places it usually lives: a crontab line, a systemd timer and a Kubernetes CronJob. Paste a five-field cron expression such as "*/15 9-17 * * 1-5" and you get the matching OnCalendar value, "Mon..Fri *-*-* 09..17:00/15:00", together with a ready .timer and .service pair, a batch/v1 CronJob manifest and the crontab line itself. The reverse mode reads OnCalendar values, including shorthands like daily, weekly or quarterly, and writes the cron equivalent when one exists. The tool knows the traps between the formats. In cron, a job with both a day of month and a weekday, such as "0 0 1,15 * 5", runs on the 1st, the 15th AND every Friday, while systemd would require both to match; the converter therefore writes two OnCalendar lines. Going the other way, a systemd schedule that needs both conditions, or one with seconds, a year or the "~" last-day syntax, cannot be expressed in cron and is reported instead of silently changed. Time zones go into the OnCalendar suffix, the CronJob timeZone field (Kubernetes 1.27 and later) and a CRON_TZ line. Persistent=true lets systemd catch up runs missed while the machine was off, which cron never does. Quartz-style expressions with six fields or ?, L, W and # are rejected with an explanation. Check the result on a server with systemd-analyze calendar. Everything runs in your browser.

How to Use

  1. Choose the direction and paste a cron expression or an OnCalendar value.
  2. Set the job name, command, container image and, if needed, an IANA time zone.
  3. Copy the timer and service files, the CronJob manifest or the crontab line and verify with systemd-analyze calendar.

Frequently Asked Questions

Why do I get two OnCalendar lines?

Cron runs a job when the day of month OR the weekday matches if both fields are restricted. systemd requires every part of one OnCalendar value to match, so the OR is expressed as two OnCalendar lines in the same timer.

Does Kubernetes use the same cron syntax?

Yes, CronJob schedules use the standard five fields and the same day-of-month or weekday rule. Time zones belong in spec.timeZone, not in the schedule string.

What does Persistent=true do?

If the machine was off or asleep when the timer should have fired, systemd runs the job once at the next boot. Cron has no equivalent and simply skips missed runs.

Is anything sent to a server?

No. The conversion runs in your browser and the page makes no network requests.

Related Tools