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

Reindl Harald h.reindl at thelounge.net
Wed Jun 10 06:57:04 UTC 2020



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

> -----Original Message-----
> From: Reindl Harald <h.reindl at thelounge.net>
> Sent: 09 June 2020 22:37
> To: Baskaran, Vinothkumar <Vinothkumar_Baskaran at comcast.com>; systemd-devel at lists.freedesktop.org
> Subject: [EXTERNAL] Re: [systemd-devel] ExecStop doesn't get called when service crashes
> 
> 
> 
> Am 09.06.20 um 18:07 schrieb Baskaran, Vinothkumar:
>> I am using systemd-244 in embedded linux yocto 3.1. Here, ExecStop
>> doesn’t get invoked when the process CcspCrSspis killed. However, when
>> service is restarted/stopped using ‘systemctl’, it gets invoked
>> successfully. The system has many services with ExecStop and it
>> doesn’t gets invoked in any of them. I have pasted one of the unit file here.
>> Please let me know if I am missing anything.
> 
> yes, the docs:
> https://urldefense.com/v3/__https://www.freedesktop.org/software/systemd/man/systemd.service.html__;!!CQl3mcHX2A!XMPI4FzT0dPBtcTPcJHQ0uoBtgTQQGG7Jx81VeUd35HN-KqSWIh7zza7ga4FSP38Sqlii7ebRg$
> 
> 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
> 

-- 

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
m: +43 676 40 221 40
p: +43 1 595 3999 33
http://www.thelounge.net/

GPG-Public-Key:
https://arrakis-tls.thelounge.net/gpg/h.reindl_thelounge.net.pub.txt


More information about the systemd-devel mailing list