Skip to content

Instantly share code, notes, and snippets.

@e-neko
Forked from jobsamuel/readme.md
Last active July 25, 2020 12:47
Show Gist options
  • Save e-neko/c68e13486c596e90cbb05dd90bea6c0e to your computer and use it in GitHub Desktop.
Save e-neko/c68e13486c596e90cbb05dd90bea6c0e to your computer and use it in GitHub Desktop.
Run NodeJS as a Service on Ubuntu 14.04 LTS
description "node.js server"
author "Foo Bar"
# 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
export HOME="/root"
exec /usr//bin/nodejs /where/yourapp/is/app.js >> /var/log/node.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