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

Reindl Harald h.reindl at thelounge.net
Wed Jun 10 08:55:09 UTC 2020


Am 10.06.20 um 09:59 schrieb Baskaran, Vinothkumar:
> Apologies if I the subject is misleading.
> 
> I meant that when the main process in the service gets crashed, ExecStop doesn't get invoked.

jesus that's exactly what the docs say

* ExecStop: clean stop of the service
* ExecStopPost: any case

>> ExecStop=
>> Note that the commands specified in ExecStop= are only executed when
>> the service started successfully first. They are not invoked if the
>> service was never started at all, or in case its start-up failed, for
>> example because any of the commands specified in ExecStart=,
>> ExecStartPre= or ExecStartPost= failed (and weren't prefixed with "-",
>> see above) or timed out. Use ExecStopPost= to invoke commands when a
>> service failed to start up correctly and is shut down again
>>
>> ExecStopPost=
>> Additional commands that are executed after the service is stopped.
>> This includes cases where the commands configured in ExecStop= were
>> used, where the service does not have any ExecStop= defined, or where
>> the service exited unexpectedly



More information about the systemd-devel mailing list