Last active
August 29, 2015 14:26
-
-
Save rafaeltuelho/aff24eefe8c6e48a6b49 to your computer and use it in GitHub Desktop.
TCP test_retry connection bash code snippet
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