mirror of
https://github.com/thegeeklab/wait-for.git
synced 2024-06-02 00:19:47 +02:00
set nc timeout to 1
This commit is contained in:
parent
5c19db4c9f
commit
b4ab35f3be
17
wait-for
17
wait-for
|
@ -10,18 +10,21 @@ echoerr() {
|
||||||
usage() {
|
usage() {
|
||||||
exitcode="$1"
|
exitcode="$1"
|
||||||
cat << USAGE >&2
|
cat << USAGE >&2
|
||||||
Usage:
|
usage: wait-for host:port [-t timeout] [-- command args]
|
||||||
$0 host:port [-t timeout] [-- command args]
|
|
||||||
-q | --quiet Do not output any status messages
|
Synchronize services like docker containers and wait for readiness.
|
||||||
-t WAITFOR_TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
|
||||||
-- COMMAND ARGS Execute command with args after the test finishes
|
optional arguments:
|
||||||
|
-q | --quiet Do not output any status messages
|
||||||
|
-t WAITFOR_TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
||||||
|
-- COMMAND ARGS Execute command with args after the test finishes
|
||||||
USAGE
|
USAGE
|
||||||
exit "$exitcode"
|
exit "$exitcode"
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for() {
|
wait_for() {
|
||||||
for _ in $(seq $WAITFOR_TIMEOUT) ; do
|
for _ in $(seq "$WAITFOR_TIMEOUT") ; do
|
||||||
nc -z "$WAITFOR_HOST" "$WAITFOR_PORT" > /dev/null 2>&1
|
nc -w 1 -z "$WAITFOR_HOST" "$WAITFOR_PORT" > /dev/null 2>&1
|
||||||
|
|
||||||
result=$?
|
result=$?
|
||||||
if [ $result -eq 0 ] ; then
|
if [ $result -eq 0 ] ; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user