hw-test/scripts/stat-bonding

54 lines
1,003 B
Text
Raw Normal View History

2017-01-25 22:30:16 -06:00
#!/bin/bash
source scan-netdev
if [[ "$1" == "out" ]] ; then
OUT=1
else
source test-variables
fi
#setup-netdev
#sleep 5
#systemctl start sshd
#sleep 1
while [[ 1 ]] ; do
if [[ -z $OUT ]] ; then
clear
fi
date
hostname
2017-01-25 22:30:16 -06:00
for BOND_N in {0..4} ; do
BOND=bond$BOND_N
if [[ -d /sys/class/net/$BOND ]] ; then
echo -n "$BOND:"
MODE=`cat /sys/class/net/$BOND/bonding/mode \
| cut -d ' ' -f 2`
echo " Mode: $BLD$MODE$OFF"
#echo
SLAVES=`cat /sys/class/net/$BOND/bonding/slaves`
2017-01-25 22:30:16 -06:00
for DEV in $SLAVES ; do
LINKING=`cat /sys/class/net/$DEV/operstate`
if [[ "$LINKING" == "up" ]] ; then
echo -n " $GRN$DEV$OFF up"
SPEED=`cat /sys/class/net/$DEV/speed`
if [[ -n $SPEED ]] ; then
echo -n " $SPEED"
fi
2017-01-25 22:30:16 -06:00
else
echo -n " $RED$DEV$OFF down"
fi
2017-01-25 22:30:16 -06:00
done
echo
if [[ $MODE == 1 ]] ; then
ACTIVE=`cat /sys/class/net/$BOND/bonding/active_slave`
echo "Active: $ACTIVE"
fi
fi
done
if [[ -n $OUT ]] ; then
exit 0
fi
sleep 2
done