2011-02-02 14:47:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-02-15 06:15:02 +00:00
|
|
|
name=`echo $NODE | awk -F- '{print $1}'`
|
|
|
|
if [ -z $name ]
|
|
|
|
then
|
|
|
|
name=$NODE
|
|
|
|
fi
|
|
|
|
|
2011-02-02 14:47:16 +00:00
|
|
|
for ((i=0;i<4;i++))
|
|
|
|
do
|
2011-02-15 06:15:02 +00:00
|
|
|
if [ $i = 0 ]
|
|
|
|
then
|
|
|
|
CLIENT_IP=`ping -c 3 $NODE | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
|
|
|
else
|
|
|
|
CLIENT_IP=`ping -c 3 $name-hf$i | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
|
|
|
fi
|
2011-02-02 14:47:16 +00:00
|
|
|
|
|
|
|
if [ -n $CLIENT_IP ]
|
|
|
|
then
|
|
|
|
echo "DEVICE=hf$i
|
|
|
|
NM_CONTROLLED=yes
|
|
|
|
IPADDR=$CLIENT_IP
|
|
|
|
NETMASK=255.0.0.0
|
|
|
|
ONBOOT=yes
|
|
|
|
" >/etc/sysconfig/network-scripts/ifcfg-hf$i
|
|
|
|
|
|
|
|
ifup hf$i
|
|
|
|
sleep 1
|
|
|
|
fi
|
2011-02-15 06:15:02 +00:00
|
|
|
|
2011-02-02 14:47:16 +00:00
|
|
|
done
|