나는 리눅스에서 만들고있는 데몬을 가지고있다. 내가있는 init.d 파일을 생성하고 성공적으로 내가 (/etc/init.d/mydaemon 정지 포함) 중지 할 때리눅스 데몬 시작 - 중지 - 데몬 중지
/etc/init.d/mydaemon start
를 사용하여 데몬 프로세스를 시작하지만, 그것은 성공적으로 중지하지만, 시작 - stop-daemon은 start-stop-daemon에 대한 호출 직후 아무런 에코도 발생하지 않는 것으로 보이지 않습니다.
Verbose 모드는 프로세스를 중지하고 시스템 모니터를보고 프로세스를 중지 함을 나타냅니다.
Stopped mydaemon (pid 13292 13310).
여기는 init.d 파일의 나의 정지 기능입니다.
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --name $NAME -v
echo "stopped"#This is never printed and the script never formally gives shell back.
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
return "$RETVAL"
}
가상 컴퓨터에서 실행하고 있는데 영향이 있습니까?