4

I have an ubuntu 10.04 server and tried to create an upstart script:

description "node-workerListener"
author      "me"

start on startup
stop on shutdown

script
        # We found $HOME is needed. Without it, we ran into problems
        export HOME="/var/www"

        exec sudo -u www-data /usr/local/bin/node /var/www/vhost/node/test/workerListener.js 2>&1 >> /var/log/node/helloworld.log
end script

This should start a node script, which works, if I start it manually on the command line. But when i try to "start node-workerListener" I get the message "node-workerListener start/running, process 1323", but it doesn't.

In /var/log/syslog: "...init: node-workerListener main process (1317) terminated with status 1"

What can I do?

bernhardh
  • 3,137
  • 10
  • 42
  • 77
  • Issue happens when you run "sudo -u www-data /usr/local/bin/node /var/www/vhost/node/test/workerListener.js 2>&1 >> /var/log/node/helloworld.log end script" On the command line? – Robert Peters Oct 16 '12 at 00:08
  • I have the same issue. Did you resolve it? – Erik Nov 08 '12 at 12:53
  • Probably has something to do with the use of sudo... try "sudo start node-workerListener" – srquinn Nov 08 '12 at 19:10
  • Found this line somewhere on the internet `start on started mountall` commented by `# used to be: start on startup // # until we found some mounts weren't ready yet while booting`. – Aleksei Zabrodskii Nov 09 '12 at 20:20

1 Answers1

-2

You can also use forever https://github.com/nodejitsu/forever to run the node process.

Here is a detailled article : http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever

xavier.seignard
  • 11,254
  • 13
  • 51
  • 75