Created
August 19, 2016 19:49
-
-
Save mths0x5f/4d3eb40325b4af8473c47c0a3bf81b08 to your computer and use it in GitHub Desktop.
Tester
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/env bash | |
CLIENT_LIST=clients | |
if [[ ! -z "$1" ]]; then | |
if [[ -f "$1" ]]; then | |
CLIENT_LIST=$1 | |
else | |
echo 'Specified file does not exist.' | |
fi | |
fi | |
while read line; do | |
set -- $line | |
printf ":: TESTING $2 ($1)\n" | |
# o if abaixo foi necessário pois o iperf3 não escreve todas as | |
# mensagens de erro no stderr, e portanto | |
# iperf3 -c $1 >> results_log 2>> error_log não funciona. | |
iperf3 -c $1 > /tmp/iperf3_last | |
if [[ $? = 0 ]]; then | |
(echo === `date +%c` ===; cat /tmp/iperf3_last) >> results_log | |
elif [[ $? = 1 ]]; then | |
(echo === `date +%c` ===; cat /tmp/iperf3_last) >> error_log | |
fi | |
done <$CLIENT_LIST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment