53 lines
1,003 B
Bash
Executable file
53 lines
1,003 B
Bash
Executable file
#!/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
|
|
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`
|
|
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
|
|
else
|
|
echo -n " $RED$DEV$OFF down"
|
|
fi
|
|
|
|
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
|