From: Mike Marchetti Date: Fri, 21 Sep 2018 16:03:05 +0000 (-0400) Subject: Add osm_health.sh check X-Git-Tag: v5.0.0~110 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=9d9192bbb48264603ea160bac095ebd07edb79d1;p=osm%2Fdevops.git Add osm_health.sh check Change-Id: I2b9a962d0bb179eb250ea1c2097ec37f52c97144 Signed-off-by: Mike Marchetti --- diff --git a/installers/osm_health.sh b/installers/osm_health.sh new file mode 100755 index 00000000..8852ab31 --- /dev/null +++ b/installers/osm_health.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +WAIT_TIME=30 +NUM_SERVICES_WITH_HEALTH=3 + +while getopts "w:s:n:" o; do + case "${o}" in + w) + WAIT_TIME=${OPTARG} + ;; + s) + STACK_NAME=${OPTARG} + ;; + n) + NUM_SERVICES_WITH_HEALTH=${OPTARG} + ;; + esac +done + + +time=0 +step=1 +while [ $time -le "$WAIT_TIME" ]; do + if [ "$(docker ps | grep " ${STACK_NAME}_" | grep -i healthy | wc -l)" -ge "$NUM_SERVICES_WITH_HEALTH" ]; then + exit 0 + fi + + sleep $step + time=$((time+step)) +done +exit 1