Skip to content

Instantly share code, notes, and snippets.

@werty1st
Forked from qharlie/gist:5271721
Created June 20, 2013 12:54
Show Gist options
  • Save werty1st/5822430 to your computer and use it in GitHub Desktop.
Save werty1st/5822430 to your computer and use it in GitHub Desktop.
Many people use forever https://github.com/nodejitsu/forever , which has become pretty much industry standard. If you are on Ubuntu, you can also use init scripts ( google 'ubuntu upstart' ), that will do much the same thing, and are guaranteed to if the server ever gets restarted. Here is my upstart script for example https://gist.github.com/qb…
#!upstart
description "MyApp"
author "MyApp by charlie"
env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
respawn
start on runlevel [23]
stop on shutdown
script
export DISPLAY=:1
export NODE_ENV=production
exec authbind node /opt/deploy/myapp/app.js >> /var/log/myapp.log
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment