Skip to content

Instantly share code, notes, and snippets.

@badslug
Created November 21, 2012 04:24
Show Gist options
  • Save badslug/4123011 to your computer and use it in GitHub Desktop.
Save badslug/4123011 to your computer and use it in GitHub Desktop.
Node.js Upstart config file running as root
description "node.js bastion server - used for services that must attach to protected ports (e.g. 80)"
author "Wyndham Jade - http://www.wyndhamjade.com"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
# Not sure why $HOME is needed, but we found that it is:
# Change the home directory to the actual home directory for the script
export HOME="/home/bastion"
exec /usr/local/bin/node /home/bastion/server.js >> /var/log/node-bastion.log 2>&1
end script
post-start script
# Optionally put a script here that will notifiy you node has (re)started
# /root/bin/hoptoad.sh "node.js has started!"
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment