Change-Id: I2b9a962d0bb179eb250ea1c2097ec37f52c97144
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
--- /dev/null
+#!/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