Skip to content

Instantly share code, notes, and snippets.

@mattmcmanus
Created July 24, 2012 15:29
Show Gist options
  • Save mattmcmanus/3170666 to your computer and use it in GitHub Desktop.
Save mattmcmanus/3170666 to your computer and use it in GitHub Desktop.
upstart
#!upstart
description "Accountable"
author "mattmcmanus"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn
respawn limit 5 60 # give up restart after 5 respawns in 60 seconds
script
echo $$ > /var/run/accountable.pid
cd /var/node/accountable/
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/node/accountable/logs/app.log
exec sudo -u node NODE_ENV=production /usr/local/bin/node app.js >> /var/node/accountable/logs/app.log 2>&1
end script
pre-stop script
rm /var/run/accountable.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/node/accountable/logs/app.log
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment