[systemd-devel] Antw: [EXT] Re: [EXTERNAL] Re: ExecStop doesn't get called when service crashes

Reindl Harald h.reindl at thelounge.net
Wed Jun 10 10:27:10 UTC 2020



Am 10.06.20 um 11:46 schrieb Ulrich Windl:
>>>> Reindl Harald <h.reindl at thelounge.net> schrieb am 10.06.2020 um 08:57 in
> Nachricht
> <24655_1591772239_5EE0844E_24655_111_1_4d778c1b-9150-c64e-574b-e5beb1b68d6a at thel
> unge.net>:
> 
>>
>> Am 10.06.20 um 05:27 schrieb Baskaran, Vinothkumar:
>>> Hi Reindal,
>>>
>>> Thanks for the inputs.
>>>
>>> In my case, the service is successfully started. The pre-script's return 
>> status is also success. Please find the output below. Still, ExecStop doesn't 
>> get invoked. I tried replacing it with ExecStopPost, it gets invoked 
>> successfully.  But, ExecStopPost cannot be used, since it gets invoked on 
>> failed cases too. 
>>
>> your subject "ExecStop doesn't get called when service crashes" simply
>> makes no sense at all then  because that's what a failed case is
> 
> Interesting case: Would FailureAction= be called then?

when the main prcoess crashes surely, that's what it's all about but
none of the actions are appealing for most services :-)

FailureAction=, SuccessAction=
Configure the action to take when the unit stops and enters a failed
state or inactive state. Takes one of none, reboot, reboot-force,
reboot-immediate, poweroff, poweroff-force, poweroff-immediate, exit,
and exit-force. In system mode, all options are allowed. In user mode,
only none, exit, and exit-force are allowed. Both options default to none.

If none is set, no action will be triggered. reboot causes a reboot
following the normal shutdown procedure (i.e. equivalent to systemctl
reboot). reboot-force causes a forced reboot which will terminate all
processes forcibly but should cause no dirty file systems on reboot
(i.e. equivalent to systemctl reboot -f) and reboot-immediate causes
immediate execution of the reboot(2) system call, which might result in
data loss (i.e. equivalent to systemctl reboot -ff). Similarly,
poweroff, poweroff-force, poweroff-immediate have the effect of powering
down the system with similar semantics. exit causes the manager to exit
following the normal shutdown procedure, and exit-force causes it
terminate without shutting down services. When exit or exit-force is
used by default the exit status of the main process of the unit (if this
applies) is returned from the service manager. However, this may be
overridden with FailureActionExitStatus=/SuccessActionExitStatus=, see
below.


More information about the systemd-devel mailing list