3 ms·
Seriously? is_ready() { while ! nc -z $1 $2; do echo "Waiting for $1:$2..." sleep 1 done echo "$1:$2 is acc
by darlingdem 2y ago
Seriously?
is_ready() {
while ! nc -z $1 $2; do
echo "Waiting for $1:$2..."
sleep 1
done
echo "$1:$2 is accessible."
}
is_ready google.com 443 &
is_ready x.com 443 &
wait
- stavepan 2y agois_ready is an alternative to this. I built it for many reasons: - Most docker images do not contain netcat so you would have to download one of them in any case. - In the case of is_ready, you won't have to write this script yourself. - Repositories like this had a lot of traffic so I supposed that engineers need a similar tool but this repository requires wget and netcat as dependencies. For this reason, I built my own without any dependencies. https://github.com/eficode/wait-for https://github.com/eficode/wait-for
- k3vinw 2y agoThis can certainly be zero dependency :) Replace the use of netcat with pure bash to test a tcp (or udp) connection: </dev/tcp/$1/$2