Skip to content

Instantly share code, notes, and snippets.

@alexbain alexbain/app.com.conf
Last active Dec 10, 2015

Embed
What would you like to do?
Upstart configuration template for a NodeJS app on Ubuntu 12.04LTS. Expected to live in ``/etc/init``
# /etc/init/APP.com.conf
description "APP.com"
start on runlevel [2345]
stop on runlevel [016]
# Restart when job dies
respawn
# Give up restart after 5 respawns in 60 seconds
respawn limit 5 60
script
echo $$ > /var/run/APP.com.pid
exec sudo -u deploy /usr/local/bin/node /home/deploy/www/APP.com/app.js 2>&1 >> /home/deploy/logs/APP.com.upstart.log
end script
pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /home/deploy/logs/APP.com.upstart.log
end script
pre-stop script
rm /var/run/alexandtala.com.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /home/deploy/logs/APP.com.upstart.log
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.