RH134 Ch 2: at, cron and systemd Timers

WebAsha's training server needs housekeeping that runs on its own: a one-off reminder, a weekday disk report for the student account, a /tmp clean-up, a nightly report as a systemd timer, and a managed runtime directory.

Tasks

  1. As user student, schedule a one-time job for teatime tomorrow that runs date /home/student/at-test.txt.
  2. In student's crontab, run df -h / /home/student/disk.log at 09:30 every weekday (Monday to Friday).
  3. Create the system cron file /etc/cron.d/webasha-cleanup that runs find /tmp -name '.tmp' -mmin +60 -delete as root every 15 minutes.
  4. Run /usr/local/bin/webasha-report.sh every day at 02:00 with a systemd timer: create webasha-report.service and webasha-report.timer in /etc/systemd/system, and enable and start the timer.
  5. Use systemd-tmpfiles to manage /run/webasha: a directory with mode 0750, owned by root:root, whose contents older than 1d are cleaned. Put the rule in /etc/tmpfiles.d/webasha.conf and create the directory now.