Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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
Add Comment
Please, Sign In to add comment