Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion wait-for-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down