Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstart: Agents should gracefully leave cluster on stop #146

Merged
merged 2 commits into from
Jul 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions templates/consul.upstart.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ script
exec start-stop-daemon -u $USER -g $GROUP -p $PID_FILE -x $CONSUL -S -- agent -config-dir $CONFIG -pid-file $PID_FILE <%= scope.lookupvar('consul::extra_options') %>
end script

pre-stop script
# Only leave the cluster if running as an agent
if ($CONSUL info 2>/dev/null | grep -q 'server = false' 2>/dev/null); then
exec $CONSUL leave
fi
end script

respawn
respawn limit 10 10
kill timeout 10