Cron Cheat Sheet: Crontab Syntax, systemd Timers, Kubernetes and GitHub Actions
Checked against cron (cronie), systemd timers, Kubernetes CronJob, GitHub Actions cronie crontab(5), systemd 262, Kubernetes 1.37 docs, GitHub Actions docs on 28 November 2026. Each section links to the official docs it was checked against.
This is for anyone who has to schedule a job and wants to get the five fields right the first time, then move the same schedule to a systemd timer, a Kubernetes CronJob or a GitHub Actions workflow. Crontab rows follow cronie's crontab(5) man page, which is what most Linux distributions ship. Nothing here could be run on the day: there is no systemd-analyze on the machine used, so every row is marked as checked against the docs only.
When to use what
Plain crontab is fine for a single server and a job that can silently miss a run when the machine is off. Move to a systemd timer when you want logs in journald, Persistent=true to catch up on missed runs, or tighter timing than the one-minute AccuracySec default; OnCalendar also reads better (Mon..Fri 09:00) than five cryptic fields. In a cluster, use a Kubernetes CronJob and always set timeZone and concurrencyPolicy, because the defaults (controller's local zone, Allow) surprise people. GitHub Actions schedules are for repo chores like stale-issue sweeps and nightly builds, not for anything that must run on the minute: runs get delayed at busy times and can even be dropped.
If you are unsure what an expression means, paste it into the crontab translator or the cron parser before you ship it, and build new ones with the crontab generator. The cron expressions guide and our cron jobs best practices post go deeper on locking and logging.
System files (/etc/crontab, /etc/cron.d/*) add a user name between the time fields and the command.
m h dom mon dow commandField order: minute 0-59, hour 0-23, day of month 1-31, month 1-12, weekday 0-7
0 or 7 in day of weekBoth mean Sunday, so 1-5 is Monday to Friday
jan-mar mon,wed,friUse three-letter month and weekday names, case-insensitive, in ranges and lists
30 2 * * * root /usr/local/bin/backup.shLine format for /etc/crontab and /etc/cron.d files: user name before the command
* * * * *Every field spans first to last, so the job runs once a minute
*/15 * * * *Run every 15 minutes, at :00, :15, :30 and :45
0 9-17 * * 1-5Run on the hour from 09:00 to 17:00, Monday to Friday
0 0-23/2 * * *Run every two hours starting at midnight
30 4 1,15 * *Run at 04:30 on the 1st and 15th of each month
*/35 * * * *Runs at :00 and :35, not every 35 minutes: steps reset each hour
6~15 * * * *cronie only: pick a random minute between 6 and 15 when the crontab loads
@rebootRun once when the cron daemon starts after boot
@daily (@midnight)Same as 0 0 * * *; @midnight is accepted by Kubernetes, not listed in cronie
@hourlySame as 0 * * * *
@weeklySame as 0 0 * * 0, midnight going into Sunday
@monthly @yearly @annuallyMidnight on the 1st of the month, or on 1 January
If both day fields are restricted, cron fires when either matches. There is no AND in standard cron.
30 4 1,15 * 5Runs on the 1st, the 15th and every Friday, not only Fridays that fall on those dates
0 9 * * 5Every Friday at 09:00; leaving day of month as * makes the weekday field decide alone
0 9 1-7 * * [ "$(date +\%u)" = 1 ] && cmdFirst Monday of the month: restrict the dates, then test the weekday in the shell
Mail each job's output to this address instead of the crontab owner
MAILTO=""Send no mail at all; pair it with your own logging
SHELL=/bin/bashRun commands with bash instead of the default /bin/sh
PATH=/usr/local/bin:/usr/bin:/binCron only sets SHELL, LOGNAME and HOME for you; define PATH and anything else in the crontab
CRON_TZ=Europe/Berlincronie: read the schedule in this time zone instead of the system zone
date +\%FEscape % with a backslash; an unescaped % ends the command and starts stdin
Check any expression with systemd-analyze calendar "<expr>", which prints the normalized form and the next run.
OnCalendar=*:0/15Every 15 minutes, like /15 * * *
OnCalendar=Mon..Fri 09:00Weekdays at 09:00, like 0 9 * * 1-5; .. marks a range
OnCalendar=dailyNormalizes to --* 00:00:00; hourly, weekly, monthly, quarterly and semiannually also exist
OnCalendar=*-*~01The last day of every month, which plain cron cannot express
OnCalendar=Mon *-05~07/1The last Monday in May
OnCalendar=weekly Pacific/AucklandAdd an IANA zone at the end to schedule in that zone
timeZone: "Etc/UTC"Pin the schedule zone; without it the controller manager's local zone is used
concurrencyPolicy: ForbidSkip a run while the previous Job is still running; Replace cancels it, Allow is the default
startingDeadlineSeconds: 200Skip a run that could not start within 200 seconds of its scheduled time
successfulJobsHistoryLimit: 3Keep 3 finished Jobs (the default); failedJobsHistoryLimit defaults to 1
on: schedule: - cron: "17 3 * * *"Run nightly at 03:17; an off-peak minute is less likely to be delayed
timezone: "America/New_York"Set next to cron to schedule in a local zone; the default is UTC
*/5 * * * *The shortest interval GitHub allows is every 5 minutes
github.event.scheduleTells you which of several cron entries started the run
@dailyNot supported in Actions: write the five fields instead
Worked example: Move a nightly backup from crontab to a systemd timer
The crontab line runs a backup at 02:30 every night and mails nothing:
MAILTO=""
30 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
The timer version adds catch-up after downtime and journald logs:
# /etc/systemd/system/backup.timer
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true
[Install]
WantedBy=timers.target
systemctl daemon-reload
systemctl enable --now backup.timer
systemd-analyze calendar "*-*-* 02:30:00"
With no Unit= line, the timer starts backup.service, the unit with the same base name, so create that service to run the script. The last command prints the normalized expression and the next time it will fire, so you can confirm it reads 02:30 in the zone you expect before trusting it. Persistent=true is the real gain: if the server was off at 02:30, the job runs at the next boot, where cron would simply skip that night. Not run here, because systemd-analyze was not available; check the output on your own host.
Common mistakes
Writing 0 9 1 * 1 and expecting it to run only when the 1st is a Monday.
Cron ORs the two day fields, so this runs on every 1st and every Monday. Keep one day field as * and test the other condition in the shell.
A script works in your terminal but fails under cron with "command not found".
Cron uses a minimal environment. Set PATH at the top of the crontab or call every program by its full path.
Using date +%Y-%m-%d inside a crontab line and getting a truncated command.
Escape each percent sign as \% or move the command into a script file.
Using /35 or /90 in the minute field and expecting a 35 or 90 minute interval.
Steps restart every hour. Use a systemd timer with OnUnitActiveSec, or run every 5 minutes and check elapsed time in the script.
Putting CRON_TZ= in a Kubernetes schedule string to change its zone.
Kubernetes rejects it. Set spec.timeZone to an IANA name like Europe/London instead.
Relying on a GitHub Actions schedule in a quiet public repo for months.
Scheduled workflows are disabled after 60 days without repository activity. Re-enable them in the Actions tab or keep the repo active.
Related cheat sheets
Sources
- https://man7.org/linux/man-pages/man5/crontab.5.html
- https://www.freedesktop.org/software/systemd/man/latest/systemd.time.html
- https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html
- https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
- https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows
- https://github.blog/changelog/2026-03-19-github-actions-late-march-2026-updates/
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.