Add netcat support from command line

pull/112/head
evandrocoan 3 years ago
parent 81b1373f17
commit 36baf32e9e

@ -15,6 +15,7 @@ Usage:
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-nc | --netcat Force to use netcat instead of bash tcp detection
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
@ -32,7 +33,7 @@ wait_for()
WAITFORIT_start_ts=$(date +%s)
while :
do
if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
if [[ $WAITFORIT_ISBUSY -eq 1 ]] || [[ $WAITFORIT_NETCAT -eq 1 ]]; then
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
WAITFORIT_result=$?
else
@ -85,6 +86,10 @@ do
WAITFORIT_QUIET=1
shift 1
;;
-nc | --netcat)
export WAITFORIT_NETCAT=1
shift 1
;;
-s | --strict)
WAITFORIT_STRICT=1
shift 1
@ -140,6 +145,7 @@ WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
export WAITFORIT_NETCAT=${WAITFORIT_NETCAT:-0}
# Check to see if timeout is from busybox?
WAITFORIT_TIMEOUT_PATH=$(type -p timeout)

Loading…
Cancel
Save