cron and OnCalendar explained
A cron or OnCalendar schedule in plain words, with the next runs.
In words
—
Next runs
How many
No runs ahead.
The same in crontab and systemd
The result will appear here
As systemd-analyze calendar shows it
The result will appear here
Calculated in your browser — nothing is sent to the server
Practice on a machine
Lab “Cron job isn't running”
In a Linux terminal
crontab -l
# the current user's jobs
crontab -e
# edit them
systemd-analyze calendar 'Mon..Fri 09:00'
# check an OnCalendar expression
systemctl list-timers
# systemd timers and their next run
Keep in mindIf both the day of month and the day of week are set, cron runs the job when either matches, not both.
FAQ
How do I run a cron job every 5 minutes?
*/5 * * * *. Every 5 minutes during working hours on weekdays: */5 9-18 * * 1-5.
Why does my cron job not run?
cron has a short PATH and none of your variables: use full paths to programs and escape % as
\%. To see what ran: grep CRON /var/log/syslog.
What time zone does cron use?
The system's, shown by timedatectl. On a server in UTC, 0 9 * * * runs at 9:00 UTC, whatever
your local time is.