by dale_glass · 3y ago · 0 comments
A timer runs a unit. Which means that you can test any timer easily by just starting the unit itself whenever needed. With cron, to test things you need to fiddle with the configuration and schedule it to run in the next minute or two, wait, check the logs, adjust, rinse and repeat.
What I would like to have in fcron is the ability to direct the job's output to the console when running a job immediately.
As for them not supporting email, if you really need to you can add an OnFailure= to the service unit to send one.
Not sure if I understand - a Cron "unit" is just a command that runs in a clean environment - you can test that without Cron.
SystemD require a "unit" wrapper around your command line - and is tricky to test without systemD? (No copy paste of the command and arguments - you would have to manually parse the ini file back into a command line).
It's not that easy to do. I've wasted hours in an old life figuring out that cron ran my scripts with a different $PATH than `env -i` did. systemd timers/units on the other hand are executed through the exact same code path, so if `systemctl start` works, you can be sure it works when started by a timer too.
But it doesn’t solve two of my other use cases: listing all unit files written by me, and version controlling or backing up unit files.
Path units for inotify triggers, mount units for NFS automounts active only when the service is running, socket units that register network triggers, all of these might have some use.
It might seem cumbersome, but I do agree that configuring complex activity sometimes means many unit files. Timer units would be a clear example.
You have identified the key point, thank you. Sometimes, things are complicated enough that you want to break configuration up into multiple units. But not always. At the moment, systemd forces you to always break it up, even when that does more harm than good.
If you want to have a separate timer unit, or several of them, fine. But you shouldn't have to.