I have been dabbling with Node.js lately, and I came across this article on how to get it to start automatically after a reboot:
http://howtonode.org/deploying-node-upstart-monit
In particular, the article recommends that I use upstart (I'm running Debian Squeeze). I've been able to install upstart fine, and when I use the "start" and "stop" commands, everything works perfect. However, whenever I reboot, Node.js never runs. The log is empty and I can't figure out why it's not working. I'm ready to give up on upstart, but I want to know if anyone else is having the same issue?
Here is my upstart script:
description "node.js server"
author "me"
start on (local-filesystems and net-device-up IFACE=eth0)
# i also tried "start on startup", still does not work.
stop on shutdown
respawn
respawn limit 5 60
script
exec sudo -u node sh -c "/usr/local/bin/node /opt/apps/firstapp/app.js >> /var/log/firstapp.log 2>&1"
end script
try to use filesystem instead of local-filesystems. Possibly /usr/local is NOT ready mounted on local-filesystems. (I had a similar issue once)