[systemd-devel] Failed to restart ntpd
Hi: It failed when i restarted ntpd service,the log showed:ntpd[3163]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING,and the ps command result showed: ntp 3993 0.0 0.0 0 0 ?Ds 10:21 0:00 [ntpd] root 3995 0.0 0.0 0 0 ?Z10:21 0:00 [ntpd] Maybe it failed because a ntpd process was still in system when started a new ntpd service.If so, how does systemctl judge that a process is over and start a new process? Liu Xueping ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Failed to restart ntpd
Before i restart ntpd,ntpd process was running: ntp 3993 0.0 0.0 7404 4156 ?Ss 10:21 0:00 /usr/sbin/ntpd -u ntp:ntp -g root 3995 0.0 0.0 7404 2364 ?S10:21 0:00 /usr/sbin/ntpd -u ntp:ntp -g so,it should be killed by systemctl and restart a new ntpd process,but it failed,i want to know systemd how to judge that a process is killed completed to start a new service. 在 2016/5/12 16:51, Reindl Harald 写道: Am 12.05.2016 um 09:17 schrieb liuxueping: Hi: It failed when i restarted ntpd service,the log showed:ntpd[3163]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING,and the ps command result showed: ntp 3993 0.0 0.0 0 0 ?Ds 10:21 0:00 [ntpd] root 3995 0.0 0.0 0 0 ?Z10:21 0:00 [ntpd] Maybe it failed because a ntpd process was still in system when started a new ntpd service.If so, how does systemctl judge that a process is over and start a new process? most likely the running one was not started by ntpd.service and hence is also not killed by systemctl - systemd is not a blind butcher like shell-scripts - it *knows* which processes are part of a service/service-group ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Failed to restart ntpd
sorry ,my description is so bad,i restart ntpd using systemctl restart ntpd command,and if it failed,the ntpd process was in D status,and it disappear in a moment,there is no ntpd process in system.The problem was found in arm64. 在 2016/5/12 17:51, Reindl Harald 写道: Am 12.05.2016 um 11:46 schrieb liuxueping: Before i restart ntpd,ntpd process was running: ntp 3993 0.0 0.0 7404 4156 ?Ss 10:21 0:00 /usr/sbin/ntpd -u ntp:ntp -g root 3995 0.0 0.0 7404 2364 ?S10:21 0:00 /usr/sbin/ntpd -u ntp:ntp -g so,it should be killed by systemctl and restart a new ntpd process,but it failed,i want to know systemd how to judge that a process is killed completed to start a new service. again: systemd monitors all processes part of a service systemctl itself does nothing, it just invokes commands when you manually started a ntpd process systemd don't know it should be killed and *it should not* get killed just because "systemctl restart ntpd" so when there is a ntpd process which is not listed in "systemctl status" you or something has manually fired up that process - don't do that at all - and you need to kill it the same way [root@rh:~]$ systemctl status ntpd ● ntpd.service - Network Time Service Loaded: loaded (/etc/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since Do 2016-05-12 10:17:54 CEST; 1h 31min ago Main PID: 981 (ntpd) CGroup: /system.slice/ntpd.service └─981 /usr/sbin/ntpd -4 -d -u ntp:ntp -p /var/run/ntpd.pid -g 在 2016/5/12 16:51, Reindl Harald 写道: Am 12.05.2016 um 09:17 schrieb liuxueping: Hi: It failed when i restarted ntpd service,the log showed:ntpd[3163]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING,and the ps command result showed: ntp 3993 0.0 0.0 0 0 ?Ds 10:21 0:00 [ntpd] root 3995 0.0 0.0 0 0 ?Z10:21 0:00 [ntpd] Maybe it failed because a ntpd process was still in system when started a new ntpd service.If so, how does systemctl judge that a process is over and start a new process? most likely the running one was not started by ntpd.service and hence is also not killed by systemctl - systemd is not a blind butcher like shell-scripts - it *knows* which processes are part of a service/service-group ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemctl how to stop a service
Hi: I have a test in arm64,my test case try to start/stop a ntp service frequently,like that: #!/bin/bash i=0 while [ 1 ];do echo "$((i++))" systemctl restart ntpd & kill -9 $! sleep 10 systemctl stop ntpd echo "stop status:$?" systemctl start ntpd ps aux >> file sleep 5 ps aux >> file status_ntpd_result=$(systemctl status ntpd.service|grep Active|awk '{print($2)}') if [ "${status_ntpd_result}" != "active" ] then echo "The status_ntpd_result is error, is not active." ps aux |grep ntp |grep -v grep exit 1 fi ps aux |grep ntpd |grep -v grep sleep 10 done A few minutes later, the ntpd service failed to start,ant systemctl status ntpd shows: ntpd[6698]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING The result of "ps aux" before sleep 5 shows: root 6698 0.0 0.0 0 0 ?Ds 08:45 0:00 [ntpd] 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. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemctl how to stop a service
Do you mean to say that systemctl will return a value when the process is still at terminate gracefully? 在 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] 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@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemctl how to stop a service
If it is as you say,it takes more time than JobTimeout,job is canceled while systemd is still trying to terminate unit,then the return value should not be 0. 在 2016/5/16 14:58, Andrei Borzenkov 写道: 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@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel