From a34b33497dbdeb7e0ad72779337c5a987636f75d Mon Sep 17 00:00:00 2001 From: swei Date: Thu, 27 Mar 2014 11:40:46 +0800 Subject: [PATCH] modify set_bonding.sh and set bond0 base on eth0 ip arg set modified: set_bonding.sh Signed-off-by: swei --- install_shell/set_bonding.sh | 38 ++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/install_shell/set_bonding.sh b/install_shell/set_bonding.sh index 1deff8e..e44c286 100755 --- a/install_shell/set_bonding.sh +++ b/install_shell/set_bonding.sh @@ -1,9 +1,39 @@ #!/bin/sh +export LANG=c + +create_ifcfg(){ +for i in $@; +do +cat > ${IF_CONFIG}/ifcfg-eth${i} <> /etc/sysconfig/modules +if [ -f ${IF_CONFIG}/ifcfg-bond0 ];then + echo "bonding exit.." +else +grep "^bonding" /etc/sysconfig/modules &> /dev/null +if [ $? -eq 0 ];then + echo 'bonding mode=6 max_bonds=1' >> /etc/sysconfig/modules +fi + +mv ${IF_CONFIG}/ifcfg-eth0 ${IF_CONFIG}/ifcfg-bond0 +sed -i "s/^DEVICE=eth0/DEVICE=bond0/g" ${IF_CONFIG}/ifcfg-bond0 + +create_ifcfg 0 2 +fi + -cp ${IF_CONFIG}/bond-examples/ifcfg-bond0 ${IF_CONFIG} -cp ${IF_CONFIG}/bond-examples/ifcfg-eth0 ${IF_CONFIG} -cp ${IF_CONFIG}/bond-examples/ifcfg-eth1 ${IF_CONFIG}