Skip to content
abdallahmekky

CHEAT SHEET

Scheduling and time cheat sheet

Run jobs on a schedule, keep the clock right and pick a tuning profile. The last RHCSA topics, in one place.

All cheat sheets

cron: the schedule format

FieldAllowed values
minute0 to 59
hour0 to 23
day of month1 to 31
month1 to 12
day of week0 to 7 (0 and 7 are both Sunday)
SymbolMeaning
*Every value
*/5Every 5th value
1,15A list
9-17A range
@reboot @daily @weeklyShortcuts for common schedules
*/5 * * * *    /usr/local/bin/check.sh      # every 5 minutes0 2 * * *      /usr/local/bin/backup.sh     # every day at 02:0030 8 * * 1-5   /usr/local/bin/report.sh     # 08:30 on weekdays0 0 1 * *      /usr/local/bin/monthly.sh    # midnight on the 1st of each month@reboot        /usr/local/bin/at-boot.sh    # once, at boot

crontab and system jobs

crontab -e              # edit your own jobscrontab -l              # list themcrontab -r              # DANGER: remove all of your jobscrontab -u alice -e     # edit another user's jobs (as root)

Files in /etc/cron.d/ and /etc/crontab add a sixth column, the user to run as:

0 2 * * *  root  /usr/local/bin/backup.sh
PathWhat it does
/etc/cron.hourly /etc/cron.dailyDrop an executable script here to run it hourly or daily
/etc/cron.weekly /etc/cron.monthlySame, weekly or monthly
/etc/cron.allow /etc/cron.denyIf cron.allow exists only listed users may use cron. Otherwise users in cron.deny are blocked.

The cron service

systemctl status crond            # the service is crond on RHELsystemctl enable --now crond      # start it now and at bootjournalctl -u crond               # what cron ran and when

Cron runs jobs with a minimal PATH, so use full paths in commands. Redirect the output if a log is wanted: command >> /var/log/job.log 2>&1.

at: run something once

echo "/usr/local/bin/job.sh" | at 14:30         # queue a job for 14:30 todayat now + 5 minutes <<< "touch /tmp/hello"       # five minutes from nowat 9am tomorrow                                 # then type the command, finish with Ctrl+Datq                                             # list queued jobsat -c 3                                         # show what job 3 will runatrm 3                                          # remove job 3
systemctl enable --now atd        # the at daemon must be running

Access works like cron: /etc/at.allow lists the users who may use at, and /etc/at.deny blocks listed users.

systemd timers

# /etc/systemd/system/backup.timer   (starts backup.service)[Unit]Description=Run the backup every day[Timer]OnCalendar=*-*-* 02:00:00Persistent=true[Install]WantedBy=timers.target
systemctl enable --now backup.timer                 # enable the timer, not the servicesystemctl list-timers                               # next and last runssystemd-analyze calendar "Mon *-*-* 02:00"          # check when an expression fires
OnCalendarFires
daily weeklyShortcuts
*-*-* 02:00:00Every day at 02:00
Mon..Fri *-*-* 09:00:00Weekdays at 09:00
*:0/15Every 15 minutes

Time and time zone

timedatectl                                 # time, zone and NTP statustimedatectl list-timezones | grep Cairo     # find a zone nametimedatectl set-timezone Africa/Cairo       # set the zonetimedatectl set-ntp true                    # keep time in sync over the networktimedatectl set-time "2026-10-09 12:00:00"  # set by hand (turn NTP off first)hwclock --systohc                           # copy the system time to the hardware clock

chrony: time synchronization

dnf install -y chronysystemctl enable --now chronyd       # the service is chronydchronyc tracking                     # how far off is the clock?chronyc sources -v                   # the time sources and their statechronyc makestep                     # step the clock right now
# /etc/chrony.confserver time.example.com iburstpool 2.rhel.pool.ntp.org iburst

After editing the file: systemctl restart chronyd.

tuned: performance profiles

dnf install -y tunedsystemctl enable --now tunedtuned-adm list                              # available profilestuned-adm active                            # the profile in usetuned-adm recommend                         # the profile tuned suggeststuned-adm profile throughput-performance    # switch profiletuned-adm off                               # turn tuning off
ProfileGood for
balancedThe general-purpose default
throughput-performanceMaximum throughput for servers
latency-performanceLow latency
virtual-guestFor virtual machines
powersaveSave energy

More cheat sheets

Questions

How do I schedule a command to run every day at 2 AM?

Run crontab -e and add the line 0 2 * * * /path/to/command. The five fields are minute, hour, day of month, month and day of week.

How do I run a command once at a specific time?

Use at. For example echo "/path/to/command" | at 14:30 queues it for 14:30. List jobs with atq and remove one with atrm.

How do I check that time synchronization works on RHEL?

Run chronyc tracking to see how far the clock is off, and chronyc sources -v to see the time sources. The service is chronyd.

What is the difference between cron and a systemd timer?

Cron runs a command on a schedule from a crontab. A systemd timer starts a service unit, so it gets systemd logging, dependencies and journalctl output.