Skip to content

Instantly share code, notes, and snippets.

@BobGneu
Created September 12, 2014 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobGneu/a6497a356eb01edbf228 to your computer and use it in GitHub Desktop.
Save BobGneu/a6497a356eb01edbf228 to your computer and use it in GitHub Desktop.
Demo node upstart definition
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
@BobGneu
Copy link
Author

BobGneu commented Sep 25, 2014

With this in place you can run it with sudo start demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment