2011-10-12 11 views
1

나는 리눅스에서 만들고있는 데몬을 가지고있다. 내가있는 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" 
} 

가상 컴퓨터에서 실행하고 있는데 영향이 있습니까?

답변

0

가상 컴퓨터에서 실행해도 영향을 미치지 않습니다.
그리고 왜 이런 일이 일어나고 있는지 또는 부모 스크립트를 어떻게 제어하는지 알 수 없습니다.

하지만, 난 그냥이 문제가 발생 내가 할 경우 발견 :

시작 - 중지 - 데몬을 ... & &이

가 예상대로 작동하고 포기합니다 -n 에코 쉘 제어.

나는 왜 이것이 작동하는지 모르지만 작동하는 것 같습니다.