diff options
Diffstat (limited to 'scripts/policy/wait_for_port.sh')
-rwxr-xr-x | scripts/policy/wait_for_port.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/policy/wait_for_port.sh b/scripts/policy/wait_for_port.sh new file mode 100755 index 00000000..10f08ded --- /dev/null +++ b/scripts/policy/wait_for_port.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ $# -ne 2 ]]; then + echo "Usage: wait-for-port hostname port" >&2 + exit 1 +fi + +host=$1 +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 + +echo "$host port $port is open" + +exit 0 |