[systemd-devel] not running ExecStop= when stopping "activating" services?

Andrei Borzenkov arvidjaar at gmail.com
Thu Mar 19 20:40:39 PDT 2015

В Thu, 19 Mar 2015 15:08:39 -0400
"Nekrasov, Alexander" <alexander.nekrasov at emc.com> пишет:

> Hi All,
> With these settings
> [Service]
> ExecStart=/cli run
> ExecStop=/cli stop
> Type=forking
> PIDFile=/tmp/cli.pid
> The service is active once "cli run" exits. A call to systemctl stop then produces a call to "cli stop". This is as expected.
> However if I call "systemctl stop" on this service before "cli run" exited, i.e., when the service is still activating, the service is stopped, all threads are killed off, but "cli stop" is never run.
> Is that as intended? Why? Is there a way to change this behavior?

This is intentional (see commit 3f6c78dc); I do not think intention was
as much "do not run ExecStopPost" as "do not spend time if starting
failed anyway"). There is currently no way to change it, it is
hardcoded. I guess you will need to present use case and explain what
is broken with current behavior.

Although there is obvious corner case - timeout expires exactly when
service starts and before systemd has chance to notice it. Then we have
fully started service that gets killed. 

> systemd-210-34.9.x86_64
> systemd-bash-completion-210-34.9.noarch
> systemd-rpm-macros-2-7.2.noarch
> util-linux-systemd-2.25-2.2.x86_64
> systemd-32bit-210-34.9.x86_64
> systemd-sysvinit-210-34.9.x86_64
> systemd-presets-branding-SLE-12.0-12.1.noarch
> Thanks,
> Alex
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel

More information about the systemd-devel mailing list