2013-04-24 114 views
6

我试图运行一个节点应用程序作为使用supervisord的服务。supervisord运行节点作为服务

如果我去到/ opt /正常运行时间和运行:

node app.js 

我的应用程序在前台启动。只要我按Ctrl + C它就会死亡。正如所料。

我已经安装了监控器和已经加入这个的配置:

[program:uptime] 
command=/usr/local/bin/node app.js 
directory=/opt/uptime/ 

我就可以开始上司成功,但如果我这样做supervisorctl状态,我得到:

uptime   BACKOFF Exited too quickly (process log may have details) 

下面是日志文件:

/var/log/supervisor/supervisord.log

2013-04-25 09:37:10,854 CRIT Supervisor running as root (no user in config file) 
2013-04-25 09:37:10,866 INFO /var/tmp/supervisor.sock:Medusa (V1.1.1.1) started at Thu Apr 25 09:37:10 2013 
Hostname: <unix domain socket> 
Port:/var/tmp/supervisor.sock 
2013-04-25 09:37:10,914 CRIT Running without any HTTP authentication checking 
2013-04-25 09:37:10,915 INFO daemonizing the process 
2013-04-25 09:37:10,917 INFO supervisord started with pid 28099 
2013-04-25 09:37:10,918 INFO spawned: 'uptime' with pid 28101 
2013-04-25 09:37:11,015 INFO exited: uptime (exit status 1; not expected) 
2013-04-25 09:37:11,016 INFO received SIGCLD indicating a child quit 
2013-04-25 09:37:12,019 INFO spawned: 'uptime' with pid 28103 
2013-04-25 09:37:12,082 INFO exited: uptime (exit status 1; not expected) 
2013-04-25 09:37:12,082 INFO received SIGCLD indicating a child quit 
2013-04-25 09:37:14,086 INFO spawned: 'uptime' with pid 28105 
2013-04-25 09:37:14,153 INFO exited: uptime (exit status 1; not expected) 
2013-04-25 09:37:14,154 INFO received SIGCLD indicating a child quit 
2013-04-25 09:37:17,157 INFO spawned: 'uptime' with pid 28107 
2013-04-25 09:37:17,220 INFO exited: uptime (exit status 1; not expected) 
2013-04-25 09:37:17,220 INFO received SIGCLD indicating a child quit 
2013-04-25 09:37:18,221 INFO gave up: uptime entered FATAL state, too many start retries too quickly 
2013-04-25 09:37:20,372 INFO localhost:0 - - [25/Apr/2013:14:37:20 -0600] "POST /RPC2 HTTP/1.0" 200 254 
2013-04-25 09:37:20,374 INFO localhost:0 - - [25/Apr/2013:14:37:20 -0600] "POST /RPC2 HTTP/1.0" 200 1236 
+0

流程日志说什么? – NilsH 2013-04-25 05:45:37

+0

我用日志编辑了原始问题...应该更易于阅读。 – ipengineer 2013-04-25 14:38:03

+0

你有/var/log/supervisord/uptime-stderr-XXXX.log吗?它说什么? – spotirca 2013-04-25 15:51:06

回答

1

如果我理解正确,代码应该是这样的:

如果目录=在/ usr/local/bin目录/:

[program:uptime] 
directory = /usr/local/bin/ 
command = node app.js 

如果目录= /选择/时间/:

[program:uptime] 
directory = /opt/uptime/ 
command = node app.js