diff --git a/scripts/_common.sh b/scripts/_common.sh index 9df5dde..495011e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,10 +5,18 @@ ROCKETCHAT_SHASUM=ed53712b37571b959b5c8c8947d6335c21fced316f2b3174bfe027fa25700c NODE_VERSION=4.7.1 waitforservice() { - isup=false; x=90; while [ $x -gt 0 ];do echo "Waiting approx. $x seconds..."; \ - x=$(( $x - 1 )); sleep 1; if $(curl -m 1 -s localhost:$port${path:-/}/api/v1/info | \ - grep -e "success.*true" >/dev/null 2>&1); then isup=true; break; fi; done && if $isup; \ - then echo "service is up"; else {ynh_die "$app could not be started"; fi + isup=false + seconds=90 + while [ $seconds -gt 0 ]; do + echo "Waiting approx. $seconds seconds..." + seconds=$(( $seconds - 1 )) + sleep 1 + if $(curl -m 1 -s localhost:$port${path:-/}/api/v1/info | grep -e "success.*true" >/dev/null 2>&1); then + isup=true + break + fi + done + $isup && echo "service is up" || ynh_die "$app could not be started" } installdeps(){