From 3aaae27a75dd2f3795dadce9a6566326751e0d0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 22 Mar 2019 13:23:02 +0100 Subject: [PATCH] man: clarify that ExecStop= is always called Fixes #11744. --- man/systemd.service.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/man/systemd.service.xml b/man/systemd.service.xml index c61e0f02961..b9a3266dfd7 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -473,14 +473,18 @@ 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. Also note that, service restart requests are - implemented as stop operations followed by start operations. This means that ExecStop= and - ExecStopPost= are executed during a service restart operation. - - It is recommended to use this setting for commands that communicate with the service requesting clean - termination. When the commands specified with this option are executed it should be assumed that the service is - still fully up and is able to react correctly to all commands. For post-mortem clean-up steps use - ExecStopPost= instead. + service failed to start up correctly and is shut down again. Also note that the stop operation is always + performed if the service started successfully, even if the processes in the service terminated on their + own or were killed. The stop commands must be prepared to deal with that case. $MAINPID + will be unset if systemd knows that the main process exited by the time the stop commands are called. + + Service restart requests are implemented as stop operations followed by start operations. This + means that ExecStop= and ExecStopPost= are executed during a + service restart operation. + + It is recommended to use this setting for commands that communicate with the service requesting + clean termination. For post-mortem clean-up steps use ExecStopPost= instead. + -- 2.39.2