Since systemd 197 timer units support calendar time events, which makes systemd a
full cron replacement. Why one would replace the good old cron? Well, because systemd
is good at executing stuff and monitor its state!
with the help of journalctl you get last status and logging output, which is a
great thing to debug failing jobs:
1234567891011
$ systemctl status reflector-update.service
reflector-update.service - "Update pacman's mirrorlist using reflector"
Loaded: loaded
(/etc/systemd/system/timer-weekly.target.wants/reflector-update.service)
Active: inactive (dead)
Jun 09 17:58:30 higgsboson reflector[30109]: rating http://www.gtlib.gatech.edu/pub/archlinux/
Jun 09 17:58:30 higgsboson reflector[30109]: rating rsync://rsync.gtlib.gatech.edu/archlinux/
Jun 09 17:58:30 higgsboson reflector[30109]: rating http://lug.mtu.edu/archlinux/
Jun 09 17:58:30 higgsboson reflector[30109]: Server Rate Time
...
there are a lot of useful systemd unit options like IOSchedulingPriority, Nice or JobTimeoutSec
it is possible to let depend units on other services, like mounting the nfs host
before starting the mysql-backup.service or depending on the network.target.
So let’s get it started. The first thing you might want to do, is to replace the
default scripts located in the runparts
directories /etc/cron.{daily,hourly,monthly,weekly}.
On my distribution (archlinux) these are logrotate, man-db, shadow and updatedb:
For convenience I created a structure like /etc/cron.*: