Running at clock times
OnCalendar schedules a job at real clock times. It accepts handy shortcuts (hourly, daily, weekly) and a precise format, DayOfWeek Year-Month-Day Hour:Minute:Second, where * means “every”:
| OnCalendar | When it runs |
|---|---|
hourly | The top of every hour |
daily | Every day at midnight |
*-*-* 09:00:00 | Every day at 09:00 |
Mon *-*-* 08:30:00 | Every Monday at 08:30 |
*-*-01 00:00:00 | Midnight on the 1st of each month |
Here's a timer that runs its service every day at 06:00. After reloading, list-timers shows when it will next run:
sudo tee /etc/systemd/system/report.timer > /dev/null <<'EOF'
[Unit]
Description=Daily report
[Timer]
OnCalendar=*-*-* 06:00:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
sudo systemctl start report.timer
systemctl list-timers report.timer --no-pagerIn the terminal
student@vulntech:~$ sudo tee /etc/systemd/system/report.timer > /dev/null <<'EOF' > [Unit] > Description=Daily report > > [Timer] > OnCalendar=*-*-* 06:00:00 > Persistent=true > > [Install] > WantedBy=timers.target > EOF [sudo] password for student: student@vulntech:~$ sudo systemctl daemon-reload student@vulntech:~$ sudo systemctl start report.timer student@vulntech:~$ systemctl list-timers report.timer --no-pager NEXT LEFT LAST PASSED UNIT ACTIVATES Mon 2026-10-19 06:00:00 UTC 22h left - - report.timer report.service 1 timers listed. Pass --all to see loaded but inactive timers, too.
Persistent=true tells systemd to run a job it missed (because the machine was off) as soon as it's back — so a nightly backup still happens even if the server was down at 2am.
Tip:
systemd-analyze calendar "daily"explains a schedule and shows the next time it would fire — a quick way to check anOnCalendarline before relying on it.
Remember:
OnCalendarsets clock schedules: shortcuts likedaily/hourly, orDOW Y-M-D H:M:Swith*for “every”.Persistent=truecatches up a missed run.