Created
May 23, 2018 15:48
-
-
Save Gordin/f1987995fe344f1c345d3b63d8fe944e to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
wait_for_hosts () { | |
for host in $@; do | |
while ! timeout 5 bash -c "echo > /dev/tcp/${host//:/\/}"; do | |
echo "$host is not available. Retrying..." | |
sleep 2 | |
done | |
echo $host is available! | |
done | |
} | |
WAIT_FOR_HOSTS="google.com:80 google.de:80 bing.com:443" | |
wait_for_hosts $WAIT_FOR_HOSTS | |
wait_for_hosts google.com:80 google.de:80 bing.com:443 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment