Skip to content

Instantly share code, notes, and snippets.

@alexbain alexbain/
Last active Dec 10, 2015

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/
description ""
start on runlevel [2345]
stop on runlevel [016]
# Restart when job dies
# Give up restart after 5 respawns in 60 seconds
respawn limit 5 60
echo $$ > /var/run/
exec sudo -u deploy /usr/local/bin/node /home/deploy/www/ 2>&1 >> /home/deploy/logs/
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/
end script
pre-stop script
rm /var/run/
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /home/deploy/logs/
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.