Skip to content

Instantly share code, notes, and snippets.

@nodekid
Created November 4, 2013 23:05
Show Gist options
  • Save nodekid/7310848 to your computer and use it in GitHub Desktop.
Save nodekid/7310848 to your computer and use it in GitHub Desktop.
Basic Upstart Job for Node Application
description "Node App Upstart Job"
author "Node Kid <_@nodekid.com>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 5 60
script
##############################################################################
APP_NAME="my-app"
APP_PATH="/var/www/nodes"
APP_ROOT="${APP_PATH}/${APP_NAME}/server"
APP_USER="www-data"
NODE_BIN="/usr/local/bin/node"
##############################################################################
exec start-stop-daemon \
--chdir "${APP_ROOT}" \
--start \
--make-pidfile \
--pidfile "${APP_ROOT}/run/${APP_NAME}.pid" \
--chuid "${APP_USER}" \
--exec \
$NODE_BIN "${APP_ROOT}/${APP_NAME}.js" \
>> "${APP_ROOT}/log/${APP_NAME}.log" 2>&1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment