Re: [systemd-devel] systemctl can't execute stop actually, when service is started by other way

2017-10-27 Thread Silvio Knizek
Am Dienstag, den 27.06.2017, 13:48 +0800 schrieb 清辰:
> for example: service nscd
> 1.execute: systemctl stop nscd.service
>   stop nscd process actually
> 2.execute: /usr/bin/nscd
>   start nscd by shell command
> 3.execute: systemctl status nscd.service
>   inactive(dead)
>   systemctl can't know nscd is running
> 4.excute: systemctl stop nscd.service
>   nscd process still exist, it seems that systemctl does not execute
> stop actually
> 
> 
> How can I stop nscd.service by systemctl when it is started not by
> systemctl?
> 
> 
> Why I need stop nscd.service by systemctl? 
> Because when linux reboot or shut down, linux will auto stop service
> by 'systemctl stop nscd.service'.
> If 'systemctl stop nscd.service' does not stop service actually, my
> service will exit abnormally. That may lead data loss in my service.
> 
> 
> Thank you very much

Hi,

you can't. Only services started by systemd are properly stopped by
systemd. Everything else will be killed during the last killing spree.
Also please keep in mind that processes you started on a shell might be
 killed as soon as the user logs out the shell belongs to. Or when the
users session is stopped.

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


Re: [systemd-devel] systemctl can't execute stop actually, when service is started by other way

2017-06-27 Thread Lennart Poettering
On Tue, 27.06.17 13:48, 清辰 (624001...@qq.com) wrote:

> for example: service nscd
> 1.execute: systemctl stop nscd.service
>   stop nscd process actually
> 2.execute: /usr/bin/nscd
>   start nscd by shell command
> 3.execute: systemctl status nscd.service
>   inactive(dead)
>   systemctl can't know nscd is running
> 4.excute: systemctl stop nscd.service
>   nscd process still exist, it seems that systemctl does not execute stop 
> actually
> 
> 
> How can I stop nscd.service by systemctl when it is started not by
> systemctl?

You cannot. systemd is a service manager. When you tell it to manage
something that means it will start/stop/introspect/... it for you. But
if you manage the service on your own, outside of it, then it won't do
any of that.

Hence: either let systemd the service and then also stop it for you,
or do it yourself, but you cannot let it stop it for you but not start
it in the first place.

Sorry,

Lennart

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


[systemd-devel] systemctl can't execute stop actually, when service is started by other way

2017-06-26 Thread ????
for example: service nscd
1.execute: systemctl stop nscd.service
  stop nscd process actually
2.execute: /usr/bin/nscd
  start nscd by shell command
3.execute: systemctl status nscd.service
  inactive(dead)
  systemctl can't know nscd is running
4.excute: systemctl stop nscd.service
  nscd process still exist, it seems that systemctl does not execute stop 
actually


How can I stop nscd.service by systemctl when it is started not by systemctl?


Why I need stop nscd.service by systemctl? 
Because when linux reboot or shut down, linux will auto stop service by 
'systemctl stop nscd.service'.
If 'systemctl stop nscd.service' does not stop service actually, my service 
will exit abnormally. That may lead data loss in my service.


Thank you very much___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel