0
我已经安装和(希望)配置在monit的创建/etc/monit.d
(在CentOS 6.5)monit的不启动节点脚本
我的任务文件称为test
一个新的任务:
check host test with address 127.0.0.1
start program = "/usr/local/bin/node /var/node/test/index.js" as uid node and gid node
stop program = "/usr/bin/pkill -f 'node /var/node/test/index.js'"
if failed port 7000 protocol HTTP
request/
with timeout 10 seconds
then restart
当我运行:
service monit restart
在我的monit日志显示:
[CEST Jul 4 09:50:43] info : monit daemon with pid [21946] killed
[CEST Jul 4 09:50:43] info : 'nsxxxxxx.ip-xxx-xxx-xxx.eu' Monit stopped
[CEST Jul 4 09:50:47] info : 'nsxxxxxx.ip-xxx-xxx-xxx.eu' Monit started
[CEST Jul 4 09:50:47] error : 'test' failed, cannot open a connection to INET[127.0.0.1:7000] via TCP
[CEST Jul 4 09:50:47] info : 'test' trying to restart
[CEST Jul 4 09:50:47] info : 'test' stop: /usr/bin/pkill
[CEST Jul 4 09:50:47] info : 'test' start: /usr/local/bin/node
我不明白为什么脚本不工作,如果我命令行与运行:
su node # user created for node scripts
node /var/node/test/index.js
一切正常......
我已经按照this tutorial。
我该如何解决这个问题?由于
没有monit的无法启动的过程中,或只是无法对HTTP响应端口7000 ? –
同样的问题,我在Ubuntu 12.我解决这个新贵https://codeplease.wordpress.com/2013/09/27/deploying-node-js-production/ – duckegg
我已经使用PM2,这是一个很棒的工具管理Node.js应用程序 –