2013-04-24 3 views
6

Sto tentando di eseguire un'applicazione nodo come servizio utilizzando supervisord.nodo di supervisione in esecuzione come servizio

Se vado a/opt/uptime e corro:

node app.js 

La mia applicazione si avvia in primo piano. Appena ho premuto ctrl + c, muore .. Come previsto.

Ho installato supervisore e ho aggiunto questo al config:

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

posso iniziare supervisore successo ma se lo faccio lo stato supervisorctl ottengo:

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

Qui ci sono i file di registro:

/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

E cosa dice il registro di processo? – NilsH

+0

Ho modificato la domanda originale con i registri ... Dovrebbe essere più facile da leggere. – ipengineer

+0

hai /var/log/supervisord/uptime-stderr-XXXX.log? Cosa dice? – spotirca

risposta

1

Se ho capito bene, il codice dovrebbe essere simile a questo:

Se directory =/usr/local/bin /:

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

Se directory =/opt/uptime /:

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