Skip to content

Instantly share code, notes, and snippets.

@vnglst
Last active February 23, 2016 10:51
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 vnglst/326efb4dfc1245ac89ca to your computer and use it in GitHub Desktop.
Save vnglst/326efb4dfc1245ac89ca to your computer and use it in GitHub Desktop.
# Upstart service for term.world node application
# Save in /etc/init/termworld.conf
description "Term.world node js application"
author "Koen van Gilst"
start on filesystem or runlevel [2345]
stop on shutdown or on runlevel [016]
setuid caddy
setgid caddy
# Respawn in case of a crash, with default parameters
respawn
respawn limit 10 5
script
export HOME=/opt/term.world/
export NODE_ENV="production"
export PORT=2016
echo $$ > /home/caddy/pids/termworld.pid
exec /usr/local/bin/node /opt/term.world/server.js >> /home/caddy/log/termworld.sys.log 2>&1
end script
pre-start script
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /home/caddy/log/termworld.sys.log
echo "Term Search started at `date +"%F %T.%N"`" | mail -s "Term Search Started" xxx@xxx.de
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment