3 ms·
> 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 fi
by e12e 3y ago
> 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.
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).
- hotnfresh 3y agoIt can take a little effort to run a command under the same environment it’ll have when cron runs it—copy-paste isn’t a full description of what you have to do. And it’s pretty easy to get wrong, then not find out until your job fails.
- Denvercoder9 3y ago> Not sure if I understand - a Cron "unit" is just a command that runs in a clean environment - you can test that without Cron. 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.