我曾爲了守護進程劍聖(使Node.js應用程序)創建了一個暴發戶腳本 新貴腳本如下的Node.js(須藤)和monit的
description "juggernaut server"
author "panojsee"
start on startup
stop on shutdown
script
# We found $HOME is needed. Without it, we ran into problems
#export HOME="/home/ubuntu/src/juggernaut"
chdir /home/ubuntu/src/juggernaut
exec sudo /usr/bin/node server.js 2>&1 >> /var/log/node.log
end script
正如你可以看到我想要使用sudo運行節點(以便我可以使用Flash套接字)。 我monit的腳本如下:
集日誌文件/var/log/monit.log
check host juggernaut with address 127.0.0.1
start program = "/sbin/start juggernaut"
stop program = "/sbin/stop juggernaut"
if failed port 8080 protocol HTTP
request/
with timeout 10 seconds
then restart
monit的不允許我有啓動程序= 「須藤/sbin目錄/開始主宰」 一旦我殺死了juggernaut(節點),那麼monit會嘗試重新啓動它,但會死於以下消息。
[UTC Feb 3 22:48:25] error : 'nodejs' failed, cannot open a connection to INET[127.0.0.1:8080] via TCP
[UTC Feb 3 22:48:25] info : 'nodejs' trying to restart
[UTC Feb 3 22:48:25] info : 'nodejs' stop: sudo
[UTC Feb 3 22:48:25] error : Error: Could not execute sudo
[UTC Feb 3 22:48:25] info : 'nodejs' start: sudo
任何線索如何告訴monit執行sudo命令?