diff --git a/xCAT-nbroot2/getdestiny b/xCAT-nbroot2/getdestiny index ac45c52a6..2f0fdbff5 100755 --- a/xCAT-nbroot2/getdestiny +++ b/xCAT-nbroot2/getdestiny @@ -6,17 +6,17 @@ echo " getdestiny 300 " > /tmp/destreq.xml -rm /tmp/destreq.xml -while [ ! -f /tmp/destreq.xml ] || grep error /tmp/destiny.xml; do - if [ -f /tmp/destreq.xml ]; then +if [ -f /tmp/destiny.xml ]; then rm /tmp/destiny.xml; fi +while [ ! -f /tmp/destiny.xml ] || grep error /tmp/destiny.xml; do + if [ -f /tmp/destiny.xml ]; then timer=60 while [ $timer -gt 0 ]; do - echo -en "Retrying in $timer seconds \r" + echo -en "Retrying in $timer seconds \r" >&2 sleep 1 timer=$(($timer-1)); done fi - echo -en " \r"; + echo " " >&2 if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml else diff --git a/xCAT-nbroot2/nextdestiny b/xCAT-nbroot2/nextdestiny index 892baa42c..193c811ef 100755 --- a/xCAT-nbroot2/nextdestiny +++ b/xCAT-nbroot2/nextdestiny @@ -6,17 +6,17 @@ echo " nextdestiny 300 " > /tmp/destreq.xml -rm /tmp/destreq.xml -while [ ! -f /tmp/destreq.xml ] || grep error /tmp/destiny.xml; do - if [ -f /tmp/destreq.xml ]; then +if [ -f /tmp/destiny.xml ]; then rm /tmp/destiny.xml; fi +while [ ! -f /tmp/destiny.xml ] || grep error /tmp/destiny.xml; do + if [ -f /tmp/destiny.xml ]; then timer=60 while [ $timer -gt 0 ]; do - echo -en "Retrying in $timer seconds \r" + echo -en "Retrying in $timer seconds \r" >&2 sleep 1 timer=$(($timer-1)); done fi - echo -en " \r"; + echo " " >&2; if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml else diff --git a/xCAT-nbroot2/xcat-cmdline.sh b/xCAT-nbroot2/xcat-cmdline.sh index 0cfb9bfd9..7314404cf 100755 --- a/xCAT-nbroot2/xcat-cmdline.sh +++ b/xCAT-nbroot2/xcat-cmdline.sh @@ -120,7 +120,7 @@ if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can a fi while :; do if [ -z "$destiny" ]; then - destiny=`getdestiny` + destiny=`getdestiny $XCATMASTER:$XCATPORT` fi destparameter=`echo $destiny|awk -F= '{print $2}'` destiny=`echo $destiny|awk -F= '{print $1}'` @@ -133,10 +133,22 @@ while :; do destiny='' /bin/sh elif [ "$destiny" = runcmd ]; then - destiny='' + destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` $destparameter + elif [ "$destiny" = runimage ]; then + destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` + mkdir /tmp/`basename $destparameter` + cd /tmp/`basename $destparameter` + ERROR=`wget $desparamater 2>&1` + while [ $? == 1 ] && echo $ERROR|grep -v 416; do + sleep 10 + ERROR=`wget -c $TARG 2>&1` + done + tar xvf `basename $TARG` + ./runme.sh + cd - elif [ "$destiny" = "reboot" -o "$destiny" = "boot" ]; then - /bin/nextdestiny + /bin/nextdestiny $XCATMASTER:$XCATPORT reboot -f elif [ "$destiny" = standby ]; then destiny=''