[root@controller01 ~]# cat bond.sh #!/bin/bashecho"eno3:"ifgrep-q"eno3" /proc/net/bonding/bond0 ;thenecho"/proc/net/bonding/bond0 :"`ip a |grep eno3`cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface: eno3"elseecho"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"ip a |grep eno3
echo"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"fiecho __________________________________________________________________
echo-e"\n"echo"ens6f0"ifgrep-q"ens6f0" /proc/net/bonding/bond0 ;thenecho"/proc/net/bonding/bond0 :"`ip a |grep ens6f0`cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface: ens6f0"elseecho"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"echo"/proc/net/bonding/bond0 :"`ip a |grep eno3`cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface: eno3"echo"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"fiecho-e"\n"up=`cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface"|egrep-A1 eno3 |grep MII |awk'{print $3}'`if[$up="down"];thenecho"eno3:"echo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface: eno3"ip a |grep ens5f0
echo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"else#为up不输出内容,下面放个echo是为了不让脚本报错echofiecho-e"\n"up=`cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface"|egrep-A1 ens6f0 |grep MII |awk'{print $3}'`if[$up="down"];thenecho"ens6f0:"echo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"cat /proc/net/bonding/bond0 |egrep-A1"Slave Interface: ens6f0"ip a |grep ens6f0
echo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"elseechofi
脚本测试
正常场景
2个网卡都正常的情况下,输出内容为下面
[root@compute31 ~]# sh bond.sh
ens5f0:
/proc/net/bonding/bond0 :8: ens5f0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
Slave Interface: ens5f0
MII Status: up
__________________________________________________________________
ens6f0
/proc/net/bonding/bond0 :
选中状态设置 _context new AIS_InteractiveContext(_viewer);var selectionDrawer new Prs3d_Drawer();selectionDrawer.SetColor(Colors.Selection);selectionDrawer.SetDisplayMode(1);selectionDrawer.SetTransparency(0.1f);_context.SetSelectionStyle(selectionDrawe…