-
-
Save mkhl/f0406a5ee427a4a337b590b7b06b575c to your computer and use it in GitHub Desktop.
A bash script waiting for port some host and port to become available without netcat or similar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
host=${1:?missing host} | |
port=${2:?missing port} | |
timeout=${3:-180} | |
until (exec 3<>"/dev/tcp/$host/$port") &>/dev/null; do | |
((timeout == 0)) && exit 1 | |
((timeout--)) | |
echo -n . | |
sleep 1 | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment