Skip to content

Instantly share code, notes, and snippets.

@suprememoocow
Created October 22, 2014 14:11
Show Gist options
  • Save suprememoocow/a00731bbb4bed8b5b58b to your computer and use it in GitHub Desktop.
Save suprememoocow/a00731bbb4bed8b5b58b to your computer and use it in GitHub Desktop.
Node upstart script
start on starting gitter-web ## The parent upstart service, so we can start and stop groups together
stop on stopping gitter-web
# Respawn, but no too much
respawn
respawn limit 10 5
# Give the process 20 seconds to shutdown properly before resorting to SIGKILL
kill timeout 20
# The environment
env NODE_ENV=prod
env PORT=5001
exec start-stop-daemon \
--start \
--make-pidfile \
--pidfile /var/run/gitter-api-1.pid \
--chuid gitter-web:gitter-web \
--chdir /path_to_logging/ \
--exec /usr/bin/node -- \
/path_to_node_process/api.js
#
# Crash reporting
#
pre-start exec /opt/upstart-monitor/bin/pre-start
pre-stop exec /opt/upstart-monitor/bin/pre-stop
post-stop exec /opt/upstart-monitor/bin/post-stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment