Skip to content

Instantly share code, notes, and snippets.

@masonwan
Created June 8, 2015 07:13
Show Gist options
  • Save masonwan/7fb24298de7ddf83855f to your computer and use it in GitHub Desktop.
Save masonwan/7fb24298de7ddf83855f to your computer and use it in GitHub Desktop.
A basic Upstart script
#!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 'An Upstart configuration tempalte'
# Let upstart attempt to restart the daemon on error, exit, or otherwise non-manual termination
respawn
pre-start script
echo 'pre-start'
end script
post-start script
echo 'post-start'
end script
# Main start instructions, send to log, route stderr to stdout
script
#exec /path/to/script >> /path/to/log 2>&1
end script
pre-stop script
echo 'pre-stop'
end script
post-stop script
echo 'post-stop'
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment