SELFHOST.COMPUTER

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.

Each field takes *, a number, a list 1,15, a range 1-5 or a step */10 (also 0-30/10). Sunday is 0 or 7.

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 * 1 fires 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 like date +\%F.
  • Environment. Cron runs with a minimal PATH and 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 @daily and @reboot shortcuts and non-standard extensions such as L, W or # (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.