Is it better to use the systemd service unit's Restart & RestartSec, or use a systemd timer unit?
I recommend to use a process manager to do your job. Luckily you have the best process manager ever on board, systemd
. In my eyes it is about semantics, even if both solutions are working for your case.
- Use timer units for cron-like schedules you are talking about.
- Use restart statements to specify a restart policy of a task that ends unexpected. That means you even can define a restart policy for your timer units, in case they failed. Keep in mind that restarting units quickly enter failed states, because they quickly reach a holdoff timeout, if you don't define a
RestartSec
greater than 1.