14 lines
255 B
Bash
Executable File
14 lines
255 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
host=${1:-127.0.0.1}
|
|
port=${2:-2222}
|
|
max_attempts=${3:-30}
|
|
for _ in $(seq 1 "$max_attempts"); do
|
|
if nc -z -w 1 "$host" "$port" 2>/dev/null; then
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
echo "timeout waiting for $host:$port" >&2
|
|
exit 1
|