Skip to content

Instantly share code, notes, and snippets.

@medesko
Forked from hubertursua/node-forever-upstart.conf
Created October 9, 2015 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medesko/d05e72e0f19da5db40c6 to your computer and use it in GitHub Desktop.
Save medesko/d05e72e0f19da5db40c6 to your computer and use it in GitHub Desktop.
NodeJS, Forever, and Upstart (Ubuntu)
#!upstart
start on filesystem and started networking
stop on shutdown
expect fork
setuid ubuntu
env HOME="/home/ubuntu"
env NODE_ENV="production"
env MIN_UPTIME="5000"
env SPIN_SLEEP_TIME="2000"
chdir /home/ubuntu/myapp
env APP_EXEC="bin/www"
env UID="myapp"
script
exec forever --uid="$UID" -a --minUptime=$MIN_UPTIME --spinSleepTime=$SPIN_SLEEP_TIME start $APP_EXEC
end script
pre-stop script
exec forever stop "$UID"
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment