Created
September 12, 2014 04:18
-
-
Save BobGneu/a6497a356eb01edbf228 to your computer and use it in GitHub Desktop.
Demo node upstart definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bob_gneu@badassmofo.google.com:~$ cat /etc/init/demo.conf | |
#!upstart | |
description "Node Demo" | |
author "bob@gneu.org" | |
env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
respawn | |
start on startup | |
stop on shutdown | |
script | |
export HOME="/home/bob_gneu" | |
echo $$ > /var/run/demo.pid | |
exec node /var/opt/demo/bin/www >> /var/log/demo.sys.log 2>&1 | |
end script | |
pre-start script | |
# Date format same as (new Date()).toISOString() for consistency | |
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/demo.sys.log | |
end script | |
pre-stop script | |
rm /var/run/demo.pid | |
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/demo.sys.log | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this in place you can run it with
sudo start demo