Cron Expression Builder
Type the five fields (or pick a preset) and see what the schedule means in plain English, plus the next five times it will fire. Handy for the backup job, certificate scripts and anything else you put in a crontab. Everything runs in your browser; nothing is sent anywhere.
Expression
Crontab line
Install it
sudo crontab -e # root's crontab crontab -e # your own user's crontab crontab -l # list what's installed
Paste the line at the bottom of the file and save. In a personal or root crontab the line is just the five fields followed by the command. Files in /etc/cron.d/ need an extra user column after the fifth field.
How it works
- The five fields are minute, hour, day of month, month and day of week. A job runs when all of them match.
- Day of month and day of week are the odd pair. If you set both to something other than
*, cron runs the job when either matches, not both.0 5 1 * 1fires on the 1st and on every Monday. This tool previews it that way and says so in the explanation. - Time zone. Cron uses the server's time zone, not yours. Check it with
timedatectl. Most VPS images default to UTC. The preview can show either UTC or your browser's zone, so pick the one that matches the server. - Percent signs have a special meaning in crontab (they turn into newlines). The tool escapes them as
\%in the generated line, which is what you need for things likedate +\%F. - Environment. Cron runs with a minimal
PATHand no login profile, so use full paths to scripts and binaries and redirect output to a log file as in the preset. - Not covered: the
@dailyand@rebootshortcuts and non-standard extensions such asL,Wor#(Quartz-style) aren't parsed, and neither is a seconds field. - Daylight saving. In a zone with DST, a job scheduled inside the skipped hour may not run that day. UTC servers avoid the issue.
Related
The nightly preset matches the cron line from the backup size planner; the restic backup guide explains the script it calls. If you'd rather have logs in the journal, retries and a "run missed jobs after downtime" option, the systemd service and timer generator does the same job with OnCalendar=. For a fresh server, see the first 15 minutes.