Skip to content

Instantly share code, notes, and snippets.

@donwb
Created July 7, 2013 17:15
Show Gist options
  • Save donwb/5944173 to your computer and use it in GitHub Desktop.
Save donwb/5944173 to your computer and use it in GitHub Desktop.
sample upstart script for node.js apps
#!upstart
description "node.js server"
author "Someone that likes Node"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on (local-filesystems and net-device-up)
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
# Not sure why $HOME is needed, but we found that it is:
export HOME="/home/ubuntu"
export NODE_ENV="development"
exec /usr/bin/node /home/ubuntu/projects/tms/app.js >> /var/log/tms-upstart.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