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

Reindl Harald h.reindl at thelounge.net
Tue Jun 9 17:06:31 UTC 2020



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://www.freedesktop.org/software/systemd/man/systemd.service.html

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