From ccd02251c26ca43fb74ff2984583bc0d854de4bb Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 2 Sep 2011 17:18:01 +0000 Subject: [PATCH] Add restart to nbroot2 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10439 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot2/dodiscovery | 2 +- xCAT-nbroot2/install | 1 + xCAT-nbroot2/restart | 61 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100755 xCAT-nbroot2/restart diff --git a/xCAT-nbroot2/dodiscovery b/xCAT-nbroot2/dodiscovery index 051c68e59..edbc693ce 100755 --- a/xCAT-nbroot2/dodiscovery +++ b/xCAT-nbroot2/dodiscovery @@ -126,4 +126,4 @@ while [ ! -r /restart ]; do cat /tmp/discopacket sleep 5 done - +/bin/restart diff --git a/xCAT-nbroot2/install b/xCAT-nbroot2/install index 8b3b85d20..8bd1e6595 100755 --- a/xCAT-nbroot2/install +++ b/xCAT-nbroot2/install @@ -590,6 +590,7 @@ inst "$moddir/bmcsetup" "/bin/bmcsetup" inst "$moddir/allowcred.awk" "/bin/allowcred.awk" inst "$moddir/getipmi" "/bin/getipmi" inst "$moddir/getdestiny" "/bin/getdestiny" +inst "$moddir/restart" "/bin/restart" inst "$moddir/nextdestiny" "/bin/nextdestiny" inst "$moddir/getcert" "/bin/getcert" inst "$moddir/dhclient.conf" "/etc/dhclient.conf" diff --git a/xCAT-nbroot2/restart b/xCAT-nbroot2/restart new file mode 100755 index 000000000..93bfb145c --- /dev/null +++ b/xCAT-nbroot2/restart @@ -0,0 +1,61 @@ +# 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}'` + if [ ! -z "$NIC" -a "$NIC" != "$FORCENICS" ]; then + dhclient -r -cf /etc/dhclient.conf -pf $pidfile $NIC + rm $pidfile + ip link set $NIC down + fi + done + for pidfile in /var/run/dhclient6.*.pid; do + NIC=`echo $pidfile|awk -F. '{print $2}'` + if [ ! -z "$NIC" -a "$NIC" != "$FORCENICS" ]; then + dhclient -6 -r -pf $pidfile -lf /var/lib/dhclient/dhclient6.leases $NIC + 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}'` + dhclient -r -cf /etc/dhclient.conf -pf $pidfile $NIC + 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}'` + dhclient -r -pf $pidfile -lf /var/lib/dhclient/dhclient6.leases $NIC + dhclient -6 -r -pf $pidfile -nw -lf /var/lib/dhclient/dhclient6.leases $NIC + done + + echo -n "Waiting 10 seconds for DHCP changes to take effect " + for i in 10 9 8 7 6 5 4 3 2 1; do + 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