Skip to content

Commit

Permalink
Merge pull request #103 from buildkite/kill-all-agents-then-wait
Browse files Browse the repository at this point in the history
Send all the kills before waiting
  • Loading branch information
toolmantim authored Jul 28, 2016
2 parents 2cd2126 + c6de848 commit d42f426
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ echo "Stopping buildkite-agent gracefully"

for i in $(seq 1 "${BUILDKITE_AGENTS_PER_INSTANCE}"); do
service "buildkite-agent-${i}" stop &
done

# Need to ensure it's the buildkite-agent user, so it doesn't match this lifecycld handler script
while pgrep -u buildkite-agent buildkite-agent > /dev/null; do
echo "Waiting for service buildkite-agent-${i} to have stopped..."
sleep 5
done
# Need to ensure it's the buildkite-agent user, so it doesn't match this lifecycld handler script
while pgrep -u buildkite-agent buildkite-agent > /dev/null; do
echo "Waiting for all buildkite-agent processes to have stopped..."
sleep 5
done

echo "buildkite-agent stopped"
echo "All buildkite-agent processes have stopped"

0 comments on commit d42f426

Please sign in to comment.