diff --git a/cmd/elastic.sh b/cmd/elastic.sh index 33bdb12..2fa59c2 100644 --- a/cmd/elastic.sh +++ b/cmd/elastic.sh @@ -21,11 +21,22 @@ register 'elastic' 'status' 'HTTP status code of the elasticsearch service' elas function elastic_wait(){ echo 'waiting for elasticsearch service to come up'; - until test $(elastic_status) -eq 200; do - printf '.' + retry_count=30 + + i=1 + while [[ "$i" -le "$retry_count" ]]; do + if [[ $(elastic_status) -eq 200 ]]; then + echo + exit 0 + fi sleep 2 + printf "." + i=$(($i + 1)) done + echo + echo "Elasticsearch did not come up, check configuration" + exit 1 } register 'elastic' 'wait' 'wait for elasticsearch to start up' elastic_wait