Linux+ 2.5.1: systemd units
A service with a timer, masking and unmasking a unit, and overriding a vendor unit with a drop-in.
Before you start
The lab installs at (for atd.service) and stops and disables atd.
Leave your work in place for grading: le-lab reset removes the timer and
reverts atd.
Tasks
- Write
labbeat.service, a oneshot service that runs/usr/bin/logger -t labbeat "still here", andlabbeat.timer, which runs it every 2 minutes. Enable and start the timer, and watch the messages arrive in the journal. - Mask
atd.serviceand see that starting it is refused. Then unmask it, and make it run now and at every boot. - With a drop-in made by
systemctl edit, runatdat nice level 5. Check it withsystemctl catandsystemctl show -p Nice. (The chapter then reverts it withsystemctl revert atd; leave it in place here.)
Hints
- Unit files go in
/etc/systemd/system/;OnCalendar=*:0/2,AccuracySec=1s,WantedBy=timers.target;systemctl daemon-reload,systemctl list-timers,journalctl -t labbeat. systemctl mask,systemctl unmask,systemctl enable --now.systemctl edit atd:[Service]andNice=5; restartatdso the running process picks it up.