2011-09-02 17:18:01 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#Redhcp, do the xcat part again
|
|
|
|
FORCENICS=`cat /restart|awk '{print $2}'`
|
|
|
|
rm /restart
|
|
|
|
if [ ! -z "$FORCENICS" ]; then
|
|
|
|
echo "Forcing down nics aside from $FORCENICS due to discoverynics setting"
|
|
|
|
for pidfile in /var/run/dhclient.*.pid; do
|
|
|
|
NIC=`echo $pidfile|awk -F. '{print $2}'`
|
2012-01-16 14:34:21 +00:00
|
|
|
if [ ! -z "$NIC" ] && echo $NIC | egrep -v "$FORCENICS"; then
|
2011-09-23 18:01:23 +00:00
|
|
|
dhclient -r -1 -cf /etc/dhclient.conf -pf $pidfile $NIC
|
2011-09-02 17:18:01 +00:00
|
|
|
rm $pidfile
|
|
|
|
ip link set $NIC down
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
for pidfile in /var/run/dhclient6.*.pid; do
|
|
|
|
NIC=`echo $pidfile|awk -F. '{print $2}'`
|
2012-01-16 14:34:21 +00:00
|
|
|
if [ ! -z "$NIC" ] && echo $NIC | egrep -v "$FORCENICS"; then
|
2011-09-23 18:01:23 +00:00
|
|
|
dhclient -6 -r -1 -pf $pidfile -lf /var/lib/dhclient/dhclient6.leases $NIC
|
2011-09-02 17:18:01 +00:00
|
|
|
rm $pidfile
|
|
|
|
ip link set $NIC down
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
WAITING=1
|
|
|
|
while [ $WAITING -gt 0 ]; do
|
|
|
|
for pidfile in /var/run/dhclient.*.pid; do
|
|
|
|
NIC=`echo $pidfile|awk -F. '{print $2}'`
|
2011-09-23 18:01:23 +00:00
|
|
|
dhclient -r -1 -cf /etc/dhclient.conf -pf $pidfile $NIC
|
2012-04-30 13:25:12 +00:00
|
|
|
ip -4 addr flush dev $NIC
|
2011-09-02 17:18:01 +00:00
|
|
|
dhclient -cf /etc/dhclient.conf -nw -pf $pidfile $NIC
|
|
|
|
done
|
|
|
|
for pidfile in /var/run/dhclient6.*.pid; do
|
|
|
|
NIC=`echo $pidfile|awk -F. '{print $2}'`
|
2011-09-23 18:01:23 +00:00
|
|
|
dhclient -6 -r -1 -pf $pidfile -lf /var/lib/dhclient/dhclient6.leases $NIC
|
2012-04-30 13:25:12 +00:00
|
|
|
ip -6 addr flush dev $NIC scope global
|
|
|
|
ip -6 addr flush dev $NIC scope site
|
2011-09-16 22:55:25 +00:00
|
|
|
dhclient -6 -pf $pidfile -nw -lf /var/lib/dhclient/dhclient6.leases $NIC
|
2011-09-02 17:18:01 +00:00
|
|
|
done
|
|
|
|
|
2012-01-31 19:25:56 +00:00
|
|
|
echo -en "Waiting 10 seconds for DHCP changes to take effect \r"
|
|
|
|
for i in 9 8 7 6 5 4 3 2 1; do
|
2011-09-02 17:18:01 +00:00
|
|
|
sleep 1
|
|
|
|
echo -en "Waiting $i seconds for DHCP changes to take effect \r"
|
|
|
|
done
|
|
|
|
WAITING=0
|
|
|
|
if [ ! -z "$FORCENICS" ]; then
|
|
|
|
for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do
|
|
|
|
if ! ifconfig $nic|grep "inet addr" > /dev/null; then
|
|
|
|
WAITING=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $WAITING -gt 0 ]; then
|
|
|
|
delay=30
|
|
|
|
while [ $delay -gt 0 ]; do
|
|
|
|
echo -en "Not all of the nics $FORCENICS managed to acquire an address, retrying in $delay seconds... \r"
|
|
|
|
done
|
|
|
|
echo " \r"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Done waiting ";
|
|
|
|
#/etc/init.d/S11stunnel #redo stunnel config
|
|
|
|
#exec /etc/init.d/S99xcat.sh
|