Created
August 10, 2018 15:59
-
-
Save bodsch/af934cb488febc6c5cc2f9f276d18f05 to your computer and use it in GitHub Desktop.
replacement for netcat
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
# now wait for ssh port | |
RETRY=20 | |
until [[ ${RETRY} -le 0 ]] | |
do | |
timeout 1 bash -c "cat < /dev/null > /dev/tcp/${VM_NAME}.${VM_DOMAIN}/22" 2> /dev/null | |
if [ $? -eq 0 ] | |
then | |
break | |
else | |
sleep 20s | |
RETRY=$(expr ${RETRY} - 1) | |
fi | |
done | |
if [[ ${RETRY} -le 0 ]] | |
then | |
printf "${red} could not connect to ssh port for '${VM_NAME}' ${endColor}\n" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment