A simple one line entry /etc/crontab and your job is set to run
In favor of systemd
Consistent run time environment with the same environment variable set. This solves a common problem with Cron jobs: They run fine in one environment and not via cron because different PATH or other values in the environment.
Better logging! systemd captures STDOUT and STDERR of your job and stores it in the systemd journal.
Better job status. You can use systemctl status your-service to check the status of what you ran. Outside of combing logs, cron offers no structured way to query the service status.
Better timer status. Use systemctl list-timers to get a summary of enabled timers and see when they last ran and when they will next run.
In summary
Systemd timers have some overhead to learn and setup, but provide a number of benefits. There some packages like systemd-cron and systemd-cron-next that allow you to have cron entries converted to systemd-timers, to try to provide a best-of-both-worlds solution
In favor of Cron
In favor of systemd
systemd
captures STDOUT and STDERR of your job and stores it in the systemd journal.systemctl status your-service
to check the status of what you ran. Outside of combing logs, cron offers no structured way to query the service status.systemctl list-timers
to get a summary of enabled timers and see when they last ran and when they will next run.In summary
Systemd timers have some overhead to learn and setup, but provide a number of benefits. There some packages like
systemd-cron
andsystemd-cron-next
that allow you to havecron
entries converted tosystemd-timers
, to try to provide a best-of-both-worlds solution