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
13 changes: 13 additions & 0 deletions wait-for-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Usage:
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-d | --delay Delay startup in seconds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
Expand Down Expand Up @@ -51,6 +52,9 @@ wait_for()

wait_for_wrapper()
{
if [[ $DELAY -gt 0 ]]; then
sleep $DELAY
fi
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
Expand Down Expand Up @@ -106,6 +110,15 @@ do
--port=*)
PORT="${1#*=}"
shift 1
;;
-d)
DELAY="$2"
if [[ $DELAY == "" ]]; then break; fi
shift 2
;;
--delay=*)
DELAY="${1#*=}"
shift 1
;;
-t)
TIMEOUT="$2"
Expand Down