가동 서비스가 시작되지 않거나 완전히 중지되지 않음 [016] # Automatically restart process if crashed respawn # Essentially

teamspeak 서버에 대한 간단한 시작 스크립트를 만들려고하는데 작동하지 않습니다.

내가 initctl start 라고 말하면 그냥 실행되지만 결코 끝나지 않거나 심지어 메시지를 내 보냅니다. stop 도 마찬가지입니다 .

내가 잘못하고 있지 않은지 확인하기 위해 cron 스크립트를 복사하여 실행하려고했지만 동일한 방식으로 발생합니다.

내가 여기서 뭘 잘못하고 있니?

최신 정보:

다음은 TS3의 스크립트입니다.

# myservice - myservice job file
description "my service description"
author "Me <myself@i.com>"

# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn

# When to start the service
start on runlevel [2345]

# When to stop the service
stop on runlevel [016]

# Automatically restart process if crashed
respawn

# Essentially lets upstart know the process will detach itself to the background
expect fork

# Start the process
script
       emit going into TS3 dir
       chdir /home/danizmax/teamspeak3-server_linux-x86/
       emit starting TS3
       exec su -c "/home/danizmax/teamspeak3-server_linux-x86/ts3server_startscript.sh start" danizmax &
       emit done
end script

가장 간단한 스크립트로도 시도했지만 작동하지 않습니다.

description     "regular background program processing daemon"

start on runlevel [2345]
stop on runlevel [!2345]

expect fork
respawn

exec echo example
console output

도와 주셔서 감사합니다.



답변

당신의 스타트 업 작업에 머리가 긁히는 이상한 점이 많이 있습니다.

1) emit는 내가 아는 프로그램이 아니므로 시스템 경로에 추가하지 않으면 오류가 발생할 수 있습니다. ‘에코’를 의미 했습니까? 보이지 않을 수도있는 시스템 콘솔로 이동하기 때문에 도움이되지 않을 수도 있습니다.

2) ‘방출’스탠자가 작동한다고 가정하면 ‘포크 기대’라고 말한 다음 실제로 두 번 포크 합니다. ‘스크립트’에 대해 한 번, 팀이 스크립트를 말할 때 다시 배경을 만듭니다.

3) 당신은 “su”스크립트를 실행하지만 start-stop-daemon은 실제로 대부분의 경우 더 간단합니다.

11.10 chdir부터는 in 스크립트 를 수행 할 필요가 없습니다. 어떤 버전의 가동이 시작된 후에 추가되었는지 확실하지 않습니다. man 5 init단어 확인chdir

start on runlevel [2345]
stop on runlevel [^2345]

respawn

chdir /home/danizmax/teamspeak-server
expect fork

exec start-stop-daemon --start --user danizmax --group danizmax --exec /home/danizmax/teamspeak3-server_linux-x86/ts3server_startscript.sh -- start

또한 / var / log / syslog에 오류가보고 될 수 있습니다. 다음을 실행하여 오류 수준을 상당히 높일 수 있습니다

initctl log-priority info

man initctl 더 많은 로그 수준.


답변