[systemd-devel] systemctl how to stop a service

Andrei Borzenkov arvidjaar at gmail.com
Mon May 16 06:58:03 UTC 2016


16.05.2016 09:01, liuxueping пишет:
> Do you mean to say that systemctl will return a value when the process
> is still at terminate gracefully?
> 

By default systemctl should wait for stop job to complete. What may
happen - if it takes more time than JobTimeout, job is canceled while
systemd is still trying to terminate unit. At least so is my understanding.

> 在 2016/5/14 18:32, Reindl Harald 写道:
>>
>> Am 14.05.2016 um 10:55 schrieb liuxueping:
>>> The result of "ps aux" before sleep 5 shows:
>>> root      6698  0.0  0.0      0     0 ?        Ds   08:45   0:00 [ntpd]

I'm not sure how to interpret it. For one, it has [...] in name which
indicates it is kernel thread. I am not aware that ntpd starts any
kernel threads and if it does, systemd does not monitor them in any
case. So /if/ this is kernel thread, the result is expected.

>>> After 5 seconds,there is no ntpd process in system.
>>>
>>> the stop status is 0,the execution of the stop command is successful,the
>>> PID of the ntpd process is 1.
>>>
>>> I would like to know if the systemctl command will wait for all the
>>> processes to exit completely before returning the result
>>
>> no, not relieable, had much fun with maradb-backups
>>
>> in case of restart it's different but "stop" is mostly a fire and forget
>> coming back in the terminal whil the daemon is still at terminate
>> gracefully - IMHO a bug
>>
>>
>>
>>
>>
>> _______________________________________________
>> systemd-devel mailing list
>> systemd-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list