1.2 KiB
1.2 KiB
LFCS 1.3: Scheduling jobs
A crontab for another user, a one-off job with at, a systemd timer, and who may use cron.
Before you start
The lab creates users alice and bob (password Lab-Pass-1) and makes
sure cron is installed and running. at isn't set up; installing it and
starting its service is part of task 2.
Tasks
- As root, schedule
/usr/bin/date >> /tmp/alice-date.logto run for useraliceat 02:30 every weekday. - Schedule a job for 10 minutes from now that writes
helloto/tmp/at-test. Check it's queued, write its job number to/root/lab-answers/2, then cancel it. - Create
cleanup.serviceandcleanup.timerthat delete files in/tmp/scratcholder than 7 days (find /tmp/scratch -mtime +7 -delete) every day at 03:00, catching up after downtime. The timer must be enabled and running. - Stop user
bobusing crontab while everyone else still can.
Hints
crontab -u alice -e,crontab -u alice -l.- The
atpackage and itsatdservice;at now + 10 minutes,atq,atrm. OnCalendar=,Persistent=,systemctl enable --now,systemctl list-timers,systemd-analyze calendar./etc/cron.allowand/etc/cron.deny.