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

2017-10-27 Thread Reindl Harald



Am 27.10.2017 um 11:53 schrieb 清辰:
Where is the 'service xxx status' result stored? Or can I change the 
service status manually, when start / stop the service outside of systemd


just don't start it outside systemd - yes it's really that easy
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-10-27 Thread Lennart Poettering
On Fr, 27.10.17 17:53, 清辰 (624001...@qq.com) wrote:

> Hi, 
> 
> 
> Where is the 'service xxx status' result stored? Or can I change the
> service status manually, when start / stop the service outside of
> systemd.

PID 1 maintains a per-service record in its internal memory. Only
PID 1 itself has write access to it.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-07-03 Thread Lennart Poettering
On Thu, 29.06.17 11:51, Oliver Neukum (oneu...@suse.com) wrote:

> Am Donnerstag, den 29.06.2017, 11:45 +0200 schrieb Reindl Harald:
> > 
> > Am 29.06.2017 um 10:05 schrieb Oliver Neukum:
> > > 
> > > 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
> > 
> > this is nonsense - how in the world should systemmd know what to stop 
> > when it has no clue about the involved processes because it did not 
> > start the service and hence has no tracking at all
> 
> So try and fail. That is still no excuse for ruling out that you can
> stop a service you have not started. That is pure politics.

Note that stopping services is more than just invoking an ExecStop=
script, as systemd will kill everything remaining after that, and
waits for all processes being gone before considering the service
properly down. All that falls apart if systemd never tracked the
service, as we neither know what to kill nor what to wait for.

In fact, a major chunk of services don't even have ExecStop= anymore,
as it is mostly redundant with this scheme, as just sending SIGTERM covers
80% of how common system services are shut down.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Reindl Harald



Am 29.06.2017 um 11:51 schrieb Oliver Neukum:

Am Donnerstag, den 29.06.2017, 11:45 +0200 schrieb Reindl Harald:


Am 29.06.2017 um 10:05 schrieb Oliver Neukum:


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


this is nonsense - how in the world should systemmd know what to stop
when it has no clue about the involved processes because it did not
start the service and hence has no tracking at all



So try and fail. That is still no excuse for ruling out that you can
stop a service you have not started. That is pure politics.


*try WHAT* - kill random processes?

simple example after that you hopefully understand why this is nonsense

* i have two servcies on several machines
* each of the has "mysqld" as ExecStart using different configs
* "mysqld.service" and "replication.service"

so what do you do when "replication.service" is not started and you say 
"systemctl stop replicatiuon.service" - kill my other mysqld?


ps aux | grep openvpn | wc -l
7

what do you do when you issue "systemctl stop openvpn1.service" and it 
is not running? kill my other 6 instanes, kill only one of them and if 
yes which one


a service manager is not a gambling machine

* if you start a process by hand kill it by hand
* if you start a process as service kill it with systemcl

it's really that easy

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Tomasz Torcz
On Thu, Jun 29, 2017 at 11:51:53AM +0200, Oliver Neukum wrote:
> Am Donnerstag, den 29.06.2017, 11:45 +0200 schrieb Reindl Harald:
> > 
> > Am 29.06.2017 um 10:05 schrieb Oliver Neukum:
> > > 
> > > 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
> > 
> > this is nonsense - how in the world should systemmd know what to stop 
> > when it has no clue about the involved processes because it did not 
> > start the service and hence has no tracking at all
> > 
> 
> So try and fail. That is still no excuse for ruling out that you can
> stop a service you have not started. That is pure politics.

  There's no service if it wasn't started by systemd. It's just a random 
binary. 



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

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Reindl Harald



Am 29.06.2017 um 10:05 schrieb Oliver Neukum:

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


this is nonsense - how in the world should systemmd know what to stop 
when it has no clue about the involved processes because it did not 
start the service and hence has no tracking at all

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Oliver Neukum
Am Donnerstag, den 29.06.2017, 11:45 +0200 schrieb Reindl Harald:
> 
> Am 29.06.2017 um 10:05 schrieb Oliver Neukum:
> > 
> > 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
> 
> this is nonsense - how in the world should systemmd know what to stop 
> when it has no clue about the involved processes because it did not 
> start the service and hence has no tracking at all
> 

So try and fail. That is still no excuse for ruling out that you can
stop a service you have not started. That is pure politics.

Regards
Oliver

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Lennart Poettering
On Thu, 29.06.17 10:05, Oliver Neukum (oneu...@suse.com) 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.

Because things are technically designed that way. When systemd manages
services it does so ensuring it will get SIGCHLD events for them. it
will also run them in a cgroup, so that it can monitor its lifetime by
enumerating the cgroup's contents, and getting events from it.

Now, if you start stuff outside of systemd nothing of that is
available, so systemd wouldn#t know that is running, and it
couldn't properly stop anything because it can't get ahold of the
processes to terminate.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Tomasz Torcz
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: zdzich...@chrome.pl-- Baron Vladimir Harkonnen

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-29 Thread Oliver Neukum
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.

Regards
Oliver

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2017-06-28 Thread Lennart Poettering
On Wed, 28.06.17 19:10, 清辰 (624001...@qq.com) wrote:

> Why? I think that will be more insured in case the status is not
> correct.

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?

I am sorry, but systemd is simply not intended to be used that
way. Either you run your stuff as systemd service and then tell
systemd to stop it again too, or do not use systemd for service
management, and then tell it somehow else.

Sorry,

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel