[systemd-devel] Restart=on-failure and SuccessAction=reboot-force causing reboots on every exit of Main PID
Lennart Poettering
lennart at poettering.net
Wed Feb 16 17:57:40 UTC 2022
On Mi, 16.02.22 11:45, Michał Rudowicz (michal.rudowicz at fl9.eu) wrote:
> Hi,
>
> I am trying to write a .service file for an application which is supposed to
> run indefinitely. The approach I have is:
>
> - if the application crashes (exits with a non-zero exit code), I want
> it to be restarted. This can be achieved easily using the Restart
> directive, like Restart=on-failure in the [Service] section.
> - if the application exits cleanly (with a zero exit code), I want the
> whole device to reboot (eg. because a software update was done). I've
> found the SuccessAction directive, which - after being set to reboot or
> reboot-force in the [Unit] section - seems to do what I want.
>
> The issue I have is: when I use both SuccessAction=reboot-force and
> Restart=on-failure in one .service file, the system reboots when I kill
> the Main PID of the service (causing non-clean exit for testing).
Can you provide a minimal .service file that shows the issue? Smells
like a bug. SuccessAction= should not be triggred if a service process
exits with SIGKILL...
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list