Skip to content

Instantly share code, notes, and snippets.

@kenperkins
Created August 22, 2011 20:36
Show Gist options
  • Save kenperkins/1163461 to your computer and use it in GitHub Desktop.
Save kenperkins/1163461 to your computer and use it in GitHub Desktop.
Clipboard.com Upstart script for Node
#!upstart
description "clipboard.com app server"
author "Ken Perkins & Mark Dawson (c) 2011"
env NAME=clipboard-app
env APP=clipboard-app.js
env LOGFILE=/home/clipboard/clipboard-app.log
env ERRORFILE=/home/clipboard/clipboard-app-error.log
env HOME="/home/clipboard/node/apps"
start on runlevel [2345]
stop on runlevel [016]
kill timeout 30
respawn
script
export NODE_ENV=production
export HOSTNAME=`hostname`
export NODE_PATH="/usr/local/lib/node:/home/clipboard/node"
timeA=`date +%s`
echo "$NAME started at $timeA" >> $LOGFILE
exec sudo -u clipboard /usr/local/bin/node $HOME/$APP 1>>$LOGFILE 2>>$ERRORFILE
end script
post-stop script
timeA=`date +%s`
echo "$NAME stopped at $timeA" >> $LOGFILE
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment