How to keep nodeJS app running
Just add a file into /etc/init with execute rights with following content:
#!upstart
description "app-name"
start on started mountall
stop on shutdown
# Automatically respawn:
respawn
respawn limit 99 5
env NODE_ENV=production
exec node /path/to/node/app/app.js >> /var/log/app-name.log 2>&1
You can access the app as a service executing any of the typical actions (start, stop and restart):
action app-name
Written by Víctor Guerrero Corbi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#