Updated script; added fault tolerant iperf testing

This commit is contained in:
Mason Rowe 2019-10-02 22:51:36 -04:00
parent 72e3b48c44
commit ed6e9778ad

46
yabs.sh
View File

@ -13,11 +13,47 @@ wget -O $IPERF_PATH/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0
wget -O $IPERF_PATH/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 -o /dev/null
chmod +x $IPERF_PATH/iperf3
I=0
IPERF_RUN_SEND="$($IPERF_PATH/iperf3 -c bouygues.iperf.fr -P 8)"
IPERF_RUN_RECV="$($IPERF_PATH/iperf3 -c bouygues.iperf.fr -P 8 -R)"
echo -e "${IPERF_RUN_SEND}" | grep SUM | grep receiver
echo -e "${IPERF_RUN_RECV}" | grep SUM | grep receiver
function iperf_test {
URL=$1
I=0
while [ $I -lt 10 ]
do
IPERF_RUN_SEND="$($IPERF_PATH/iperf3 -c $URL -P 8)"
if [[ "$IPERF_RUN_SEND" != *"error"* ]]; then
I=10
#echo "iperf Send Success!!" # debug
else
I=$(( $I + 1 ))
#echo "iperf Send Failure..." # debug
sleep 3
fi
done
J=0
while [ $J -lt 10 ]
do
IPERF_RUN_RECV="$($IPERF_PATH/iperf3 -c $URL -P 8 -R)"
if [[ "$IPERF_RUN_SEND" != *"error"* ]]; then
J=10
#echo "iperf Recv Success!!" # debug
else
J=$(( $I + 1 ))
#echo "iperf Recv Failure..." # debug
sleep 3
fi
done
IPERF_SENDRESULT="$(echo "${IPERF_RUN_SEND}" | grep SUM | grep receiver)"
IPERF_RECVRESULT="$(echo "${IPERF_RUN_RECV}" | grep SUM | grep receiver)"
}
IPERF_LOCS=("bouygues.iperf.fr" "ping.online.net" )
for loc in ${IPERF_LOCS[@]}; do
iperf_test $loc
echo "Send result: $IPERF_SENDRESULT"
echo "Recv result: $IPERF_RECVRESULT"
done
# iperf debug
#echo -e "#######################"