It was recently pointed out to me that an alternative to cron exists, namely systemd timers.
However, I know nothing about systemd or systemd timers. I have only used cron.
There is a little discussion in the Arch Wiki. However, I'm looking for a detailed comparison between
cron and systemd timers, focusing on pros and cons. I use Debian, but I would like a general comparison for all systems for which these two alternatives are available. This set may include only Linux distributions.
Here is what I know.
Cron is very old, going back to the late 1970s. The original author of cron is Ken Thompson, the creator of Unix. Vixie cron, of which the crons in modern Linux distributions are direct descendants, dates from 1987.
Systemd is much newer, and somewhat controversial. Wikipedia tells me its initial release was 30 March 2010.
So, my current list of advantages of cron over systemd timers is:
Cron is guaranteed to be in any Unix-like system, in the sense of being an installable supported piece of software. That is not going to change. In contrast, systemd may or may not remain in Linux distributions in the future. It is mainly an init system, and may be replaced by a different init system.
Cron is simple to use. Definitely simpler than systemd timers.
The corresponding list of advantages of systemd timers over cron is:
- Systemd timers may be more flexible and capable. But I'd like examples of that.
So, to summarise, here are some things it would be good to see in an answer:
- A detailed comparison of cron vs systemd timers, including pros and cons of using each.
- Examples of things one can do that the other cannot.
- At least one side-by-side comparison of a cron script vs a systemd timers script.