Schedule Jobs with systemd Timers
Two programs must run unattended: a report every five minutes on the clock, and a heartbeat that starts shortly after boot and repeats. Wrap the first in a oneshot service, drive both with timers, and prove from the journal that they ran.
Skill labintermediate~30 minPro
What you'll do
- ✓Read existing timers and the units they start with systemctl list-timers
- ✓Write a oneshot service and a timer that starts it, and enable the timer, not the service
- ✓Test a calendar expression with systemd-analyze calendar before using it
- ✓Choose between calendar and monotonic timers, and know what Persistent= adds
- ✓Find the runs of a scheduled job in the journal
Lab outline
- 01The job
- 02A calendar timer
- 03A monotonic timer and its runs
Before you start
- Operate systemd Services
- Create and Harden a Custom systemd Service
Every lab runs on a real machine of your own in the browser — no installs, nothing to clean up — and checks your work automatically as you go.