1.3 KiB
1.3 KiB
RHCSA 7.1: Scheduling tasks: at, cron and systemd timers
A crontab for another user, a systemd timer that runs every 15 minutes,
and one-off jobs with at.
Before you start
The lab creates user alice (password Lab-Pass-1) with an empty
crontab, makes sure cron is running, and removes /tmp/at-ran. at isn't
set up; installing it and starting its service is part of task 3.
Tasks
- As root, schedule a job for user
alicethat runs/usr/bin/logger helloevery weekday at 14:30. - Make a systemd timer that runs a script every 15 minutes and survives a
reboot. After a reboot,
systemctl list-timerslists it with a next run at most 15 minutes away; wait until it has fired once. - Use
atto create a file/tmp/at-rantwo minutes from now. Then schedule another job and cancel it.
Hints
crontab -u alice -e,crontab -l -u alice; fields are minute, hour, day of month, month, day of week.- A script (
chmod +x), a.servicewithType=oneshotandExecStart=, and a.timerwithOnCalendar=*:0/15(orOnUnitActiveSec=15minwithOnBootSec=) in/etc/systemd/system/;systemctl daemon-reload,systemctl enable --now NAME.timer;journalctl -u NAME.service. dnf install at,systemctl enable --now atd;at now + 2 minutes,atq,atrm.