summaryrefslogtreecommitdiffstats
path: root/scripts/policy/wait_for_port.sh
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2019-04-29 20:17:45 -0500
committerBilal A <bilal@research.att.com>2019-06-03 17:58:53 +0000
commit1e0b621a2449411fcd0e5f2cce247170b6d12bd7 (patch)
tree1b10ec7b8e57629431a5e0f7b61d752a1d89e12b /scripts/policy/wait_for_port.sh
parent7c6988932beb63e6c572e14086983208cd61ca34 (diff)
Restructure CSITs for info and timeouts
Change-Id: I8a1bf5d44da267e58f26e877fc0eba7189166424 Issue-ID: POLICY-1712 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> (cherry picked from commit de399b090495c66e7c8ae5f07c1b60056b886656)
Diffstat (limited to 'scripts/policy/wait_for_port.sh')
-rwxr-xr-xscripts/policy/wait_for_port.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/policy/wait_for_port.sh b/scripts/policy/wait_for_port.sh
index 10f08ded..58bf25d0 100755
--- a/scripts/policy/wait_for_port.sh
+++ b/scripts/policy/wait_for_port.sh
@@ -5,14 +5,17 @@ if [[ $# -ne 2 ]]; then
exit 1
fi
-host=$1
-port=$2
+export host=$1
+export port=$2
echo "Waiting for $host port $port open"
-until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do
- sleep 1
-done
+timeout 120 bash -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done'
+rc=$?
-echo "$host port $port is open"
+if [[ $rc != 0 ]]; then
+ echo "$host port $port cannot be reached"
+ exit $rc
+fi
+echo "$host port $port is open"
exit 0