hw-test/scripts/test-iperf-hosts-massive

39 lines
828 B
Text
Raw Normal View History

2022-07-02 03:25:25 -05:00
#!/bin/bash
source scan-netdev
MY_DATE=`date +%Y-%m-%d_%H-%M-%S`
mkdir -p $OUTPUT_DIR/iperf
MY_IP=` ip addr list eth0 | awk '/inet / {print $2}' | cut -d '/' -f 1`
echo "My IP: $MY_IP"
MY_PORT=`grep "$MY_IP " /etc/hosts \
| cut -d ' ' -f 3 \
| cut -d '-' -f 3 \
| cut -b 3,4`
if [[ -z $MY_PORT ]] ; then
echo "My Port empty"
exit 27
fi
IP_LIST=`sed 's/#.*$//' /etc/hosts \
| grep -v 'localhost' \
| cut -d ' ' -f 1 \
| grep '^[0-9]' | sort -n`
for IP in $IP_LIST; do
#echo $IP
[[ $IP == $MY_IP ]] && continue
echo -n "$IP - "
echo "iperf3 -P 4 -p 52$MY_PORT -c $IP" \
> $OUTPUT_DIR/iperf/client.$IP.cmd
cat $OUTPUT_DIR/iperf/client.$IP.cmd
iperf3 -P 4 -p 52$MY_PORT \
--logfile $OUTPUT_DIR/iperf/client.$IP.log \
-c $IP &
#RES=$?
#echo $RES
#echo $RES >> $OUTPUT_DIR/iperf/client.$IP.cmd
done