Created
September 13, 2016 14:59
-
-
Save scottsbaldwin/d71b76e4d369925477d0decdd8b28371 to your computer and use it in GitHub Desktop.
Check if host:port is up
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/bash | |
# see https://securityreliks.wordpress.com/2010/08/20/devtcp-as-a-weapon/ | |
echo "Waiting for ${HOST}:${PORT} to become available" | |
while : | |
do | |
(echo > /dev/tcp/${HOST}/${PORT}) >/dev/null 2>&1 | |
available=$? | |
if [[ $available -eq 0 ]]; then | |
echo "Service on ${HOST}:${PORT}" is available | |
break | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment