From: Holger Levsen Date: Thu, 8 Nov 2012 19:34:33 +0000 (+0100) Subject: check for sshd running, not only if the host pings X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=854994a9865f5774d13750efa6bdbac63a850ef4;p=profitbricks%2Fjenkins-build-scripts.git check for sshd running, not only if the host pings --- diff --git a/liveboot_testdeploy.sh b/liveboot_testdeploy.sh index a96e51e..0b3e0c6 100755 --- a/liveboot_testdeploy.sh +++ b/liveboot_testdeploy.sh @@ -64,19 +64,19 @@ cat $TESTSERVER_MGMT_PASSWD_FILE | ipmitool -H $TESTSERVER_MGMT_IP -U ADMIN -a sleep 3 if $(ping -c 1 $TESTSERVER >/dev/null) ; then figlet "Warning:" - echo "$TESTSERVER responds to pings, even though it was reseted 3secs ago, this should not happen, please investigate manually." + echo "$TESTSERVER responds to pings, even though it was reset 3secs ago, this should not happen, please investigate manually." exit 1 fi # -# check for 10min whether it's up again +# check for 10min whether it's booting up again # echo "Pinging $TESTSERVER..." for i in $(seq 1 60) ; do sleep 10 echo "." if $(ping -c 1 $TESTSERVER >/dev/null) ; then - echo "$TESTSERVER pings again, so we assume it's up." + echo "$TESTSERVER pings again, so we assume it's booting now." break fi done @@ -86,6 +86,29 @@ if ! $(ping -c 1 $TESTSERVER >/dev/null) ; then exit 1 fi +# +# check for 15min whether ssh comes back +# +echo "Checking for sshd running on $TESTSERVER..." +for i in $(seq 1 90) ; do + sleep 10 + if $(ping -c 1 $TESTSERVER >/dev/null) ; then + echo -n "ping $TESTSERVER ok..." + # check ssh FIXME + if $(nc -z $TESTSERVER 22 ) ; then + echo "ok, sshd is running." + break + else + echo "but sshd is not running." + fi + fi +done +if ! $(nc -z $TESTSERVER 22 ) ; then + figlet "Failure:" + echo "$TESTSERVER still not running sshd, please investigate." + exit 1 +fi + # # send announce mail # @@ -95,7 +118,10 @@ if [ ! -e $MAIL ] ; then echo "$MAIL does not exist, something wrong with liveboot-web?" exit 1 fi -cat $MAIL | /usr/sbin/sendmail $MAILTO && echo "Ok, mail to $MAILTO send." +cat $MAIL +cat $MAIL | /usr/sbin/sendmail $MAILTO +echo +echo "Ok, mail to $MAILTO send." # # finish