Skip to content

Instantly share code, notes, and snippets.

@c0debreaker
Forked from MattSurabian/upstartTemplate.conf
Created March 13, 2014 21:15
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 c0debreaker/9537132 to your computer and use it in GitHub Desktop.
Save c0debreaker/9537132 to your computer and use it in GitHub Desktop.
#!upstart
#
# Copy me to /etc/init/
# This installs a daemon as a system level call and ensures the process can be monitored and is consistently restarted on error.
# Manual start, stop, and restart respected.
#
description "DESCRIBE_ME"
# Let upstart attempt to restart the daemon on error, exit, or otherwise non-manual termination
respawn
pre-start script
SOMETHING_TO_DO_PRE_START
end script
# Write an alive file for collectd to poll
post-start script
touch PATH_TO_ALIVE_FILE
end script
# Main start instructions, send to log, route stderr to stdout
script
PATH_TO_COMMAND >> PATH_TO_LOG 2>&1
end script
pre-stop script
SOMETHING_TO_DO_PRE_STOP
end script
# Remove alive file
post-stop script
rm -f PATH_TO_ALIVE_FILE
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment