[systemd-devel] 回复: 回复: [systemd-de vel] systemctl can't execute stop actually,whenservice is started by other way

Tomasz Torcz tomek at pipebreaker.pl
Thu Jun 29 08:18:42 UTC 2017

On Thu, Jun 29, 2017 at 10:05:08AM +0200, Oliver Neukum wrote:
> Am Mittwoch, den 28.06.2017, 13:29 +0200 schrieb Lennart Poettering:
> > Well, it's a service manager. As such it keeps track of services,
> > knows when they are started and when they aren't. Why would it stop
> > services that aren't started?
> Because you command it to do so.
> The check systemd does adds no value. There is a reason to not start
> something that is running. The reverse does not apply.

  By starting nscd in some shell session, there's no mapping between
running executable and a service.  Systemd has no way of knowing
that random nscd binary is supposed to be killed when 'systemctl stop nscd'
is invoked. How would it know?

  That is really the question! How systemd would know that unrelated
binary should be killed when user invokes 'systemctl stop' on service,
service which has not been started?  Is systemd supposed to compare full
path of all running binaries to ExecStart= lines in unit files? But what
about situation when you have multiple services with the same ExecStart=?

  Maybe user starting random binaries in login session should echo their
PIDs into 'tasks' file in relevant cgroup? What if the cgroup does not exists
yet (because service wasn't started)? This quickly becames a dangerous hackery.

  I'm all ears – what's your solution?

Tomasz Torcz                 Morality must always be based on practicality.
xmpp: zdzichubg at chrome.pl                -- Baron Vladimir Harkonnen

More information about the systemd-devel mailing list