Created
July 17, 2012 08:47
-
-
Save 1st8/3128135 to your computer and use it in GitHub Desktop.
God process monitoring + Upstart + rbenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "God Process Monitoring" | |
author "Christoph Geschwind <[email protected]>" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn # respawn the service if it dies | |
respawn limit 5 10 # stop respawning if it fails 5 times in 10 seconds | |
pre-start script | |
mkdir -p /var/run/god # create gods pid directory, you might not need this | |
end script | |
script | |
. /etc/profile.d/phoenix.sh # load environment variables, you might replace or not need this at all | |
export RBENV_ROOT="/usr/local/rbenv" # set required rbenv variable | |
# launch god via rbenv NOT daemonized, loads a centralized config in /etc/god.conf | |
exec /usr/local/rbenv/bin/rbenv exec god -D -c /etc/god.conf | |
# could not get this working without the -D flag and any expect behaviour, | |
# see http://upstart.ubuntu.com/cookbook/#expect for more information | |
# this paragraph supported my decision: | |
# "If your daemon has a "don't daemonize" or "run in the foreground" mode, then it's much simpler to use that and not run | |
# with fork following. One issue with that though, is that Upstart will emit the started JOB=yourjob event as soon as it has | |
# executed your daemon, which may be before it has had time to listen for incoming connections or fully initialize." | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just what I was looking for. Thanks!