-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
ES_HOST=${1:-"localhost:9200"} | ||
|
||
until $(curl --output /dev/null --silent --head --fail "$ES_HOST"); do | ||
printf '.' | ||
sleep 1 | ||
done | ||
|
||
# Wait for ES to start... | ||
response=$(curl "$ES_HOST") | ||
until [ "$response" = "200" ]; do | ||
response=$(curl --write-out %{http_code} --silent --output /dev/null "$ES_HOST") | ||
>&2 echo "Elastic Search is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
|
||
# Wait for ES status to turn to Green | ||
health="$(curl -fsSL "$ES_HOST/_cat/health?h=status")" | ||
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ") | ||
|
||
until [ "$health" = 'green' ]; do | ||
health="$(curl -fsSL "$ES_HOST/_cat/health?h=status")" | ||
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ") | ||
>&2 echo "Elastic Search is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
|
||
>&2 echo "Elastic Search is up" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
ES_HOST=${1:-"localhost:9200"} | ||
|
||
until $(curl --output /dev/null --silent --head --fail "$ES_HOST"); do | ||
printf '.' | ||
sleep 1 | ||
done |