Hi,
I have a systemd service unit that I configured for automatic restart if the main process exits with a failure. What I want to achieve is that a system reboot is performed if the service has failed more than a given number of times.
Hi,
I have a systemd service unit that I configured for automatic restart if the main process exits with a failure. What I want to achieve is that a system reboot is performed if the service has failed more than a given number of times.
You may want to try something with:
You’ll have to define the limits and burst to match what you want to achieve.
StartLimitAction=
Configure an additional action to take if the rate limit configured with
StartLimitIntervalSec=
andStartLimitBurst=
is hit. Takes the same values as theFailureAction=
/SuccessAction=
settings. Ifnone
is set, hitting the rate limit will trigger no action except that the start will not be permitted. Defaults tonone
.
ref: systemd.unit
Reboot is a last resort option that should not be used normally.
If things go wrong, you may end up in a boot loop.
It is best to try debugging and check logs for troubleshooting.
That’s a good practice; but I’ve ran rolling oS TW and Fedora Server auto-updating everything and rebooting daily for years and never had an update cause a boot-loop
Rebooting to apply updates is justified, but not to restart a service.
Even a minor mistake in this startup check can exacerbate the problem.