hw-test/scripts/test-ping

42 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
source scan-netdev
#VLANS='110 218 222 226 306 321 480'
MY_DATE=`date +%Y-%m-%d_%H-%M-%S`
if [[ -n $1 ]] ; then
MTU=`echo $1 | sed 's/[^0-9]//g'`
if [[ "$MTU" != "" ]] ; then
MTU_P=" -s $MTU"
LABEL=".$MTU"
fi
fi
stat-bonding out > $OUTPUT_DIR/bonding.out
echo -n "START: " > $OUTPUT_DIR/ping$LABEL.out
date >> $OUTPUT_DIR/ping$LABEL.out
for VLAN in {10..4000} ; do
if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then
VLAN_CONF=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
| grep $SERVER_SERIAL `
else
continue
fi
if [[ -z $VLAN_CONF ]] ; then
continue
fi
IP_LIST=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
| cut -d ',' -f 3 \
| grep '^[0-9]' | sort`
for IP in $IP_LIST; do
echo -n "$IP - " \
| tee -a $OUTPUT_DIR/ping$LABEL.out
ping -c100 -W1 $MTU_P -f $IP \
| grep 'received' \
| tee -a $OUTPUT_DIR/ping$LABEL.out
done
done
echo -n "END: " >> $OUTPUT_DIR/ping$LABEL.out
date >> $OUTPUT_DIR/ping$LABEL.out
cp -vf $OUTPUT_DIR/ping$LABEL.out $OUTPUT_DIR/ping-$MY_DATE$LABEL.out
cp -vf $OUTPUT_DIR/bonding.out $OUTPUT_DIR/bonding-$MY_DATE.out