Forked from rafaeltuelho/service_tcp_test_retry_connection.sh
Last active
August 29, 2015 14:26
-
-
Save sethkontny/73092e9d4582ac7b43da to your computer and use it in GitHub Desktop.
TCP test_retry connection bash code snipet
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
#test if the service is up | |
CONN_STATUS="DOWN" | |
COUNTER=0 | |
while [ "$CONN_STATUS" == "DOWN" -a $COUNTER -lt 4 ] | |
do | |
CONN_STATUS=`(echo > /dev/tcp/$SERVICE_ADDR/$SERVICE_PORT) >/dev/null 2>&1 && echo "UP" || echo "DOWN"` | |
echo -e "\t SERVICE connection status: $CONN_STATUS" | |
echo -e "\t waintig 5s for Service connetion..." | |
sleep 5 | |
let COUNTER=COUNTER+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment