Skip to content

Commit

Permalink
fallback to /dev/tcp if no netcat
Browse files Browse the repository at this point in the history
  • Loading branch information
realies committed Nov 26, 2018
1 parent 8283864 commit 2c082fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wait-for
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c082fc

Please sign in to comment.