From 2c082fc1058653086f061afcb70d418442d384f9 Mon Sep 17 00:00:00 2001 From: realies Date: Mon, 26 Nov 2018 22:34:52 +0000 Subject: [PATCH] fallback to /dev/tcp if no netcat --- wait-for | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wait-for b/wait-for index ddfc39e..cef482a 100755 --- a/wait-for +++ b/wait-for @@ -21,8 +21,12 @@ USAGE wait_for() { for i in `seq $TIMEOUT` ; do - nc -z "$HOST" "$PORT" > /dev/null 2>&1 - + if which nc > /dev/null; then + nc -z "$HOST" "$PORT" > /dev/null 2>&1 + else + (echo > /dev/tcp/$HOST/$PORT) > /dev/null 2>&1 + fi + result=$? if [ $result -eq 0 ] ; then if [ $# -gt 0 ] ; then