Skip to content

Instantly share code, notes, and snippets.

@techjacker
Last active August 29, 2015 14:20
Show Gist options
  • Save techjacker/8e9dd09c180bbe59c665 to your computer and use it in GitHub Desktop.
Save techjacker/8e9dd09c180bbe59c665 to your computer and use it in GitHub Desktop.
Node.js app init with Upstart
# /etc/init/nodejsservice.conf
description "Node Restart Script: Using Upstart"
author "Andrew Griffiths"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
setuid www-data
setgid www-data
respawn # default = 10 respawns per 5 seconds
respawn limit 99 5 # 99 respawns per 5 seconds
# Max open files are @ 1024 by default. Bit few.
limit nofile 32768 32768
script
. '/home/some_user/install-script/env_vars.conf'
export NODE_ENV
/opt/joyent/node/bin/node ${APP} >> ${LOGPATHAPP} 2>&1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment