I have a couple of in-house automated scripts running at periodic intervals. One is every five minutes, the other is every minute. They don't really need to be ran on-the-dot; e.g. I don't care if they run at 12:00, 12:05, etc. or at 12:03, 12:08, etc., I just need a steady interval.
Currently, I have crontab running these scripts at the specified intervals. However, on the same machine I also have custom in-house systemd service unit files. I was curious if it would be better to move my scripts to systemd service unit & timer files, or just use systemd service unit files with Restart & RestartSec directives.
Let me know if I need to rephrase something or if I'm being unclear.
Specifically, the definition for systemd.service units translates Restart=always
and RestartSec=300
to be synonymous as "always run every five minutes while ignoring the exit code of the previous run". However, there's also the systemd.timer unit that could be configured to do the same but probably with specific exit codes such as successful exit only.
I'm looking for pros and cons of both.
Thanks!