set -x
export
+TESTSERVER=pserver2
+TESTSERVER_MGMT_IP=192.168.178.49
+TESTSERVER_MGMT_PASSWD_FILE=/etc/jenkins/pserver2.ipmi
+
+MAILTO=liveboot-announce@profitbricks.com
+
+#
+# check if we have a LIVEBOOT_ID
+#
if [ "$LIVEBOOT_ID" != "" ] ; then
echo "Ok, got LIVEBOOT_ID=$LIVEBOOT_ID"
else
echo "Fail, no LIVEBOOT_ID set."
exit 1
fi
-
+#
+# check if there is an image for it
+#
if [ -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ ] ; then
SOURCE_DIR=$(ls -d /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/)
else
- echo "Fail, /srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ does not exist."
+ figlet "Failure:"
+ echo "/srv/mirror/liveboot/liveboot-????????-${LIVEBOOT_ID}/ does not exist."
exit 1
fi
-TESTSERVER=pserver2
-
+# FIXME
+#
+# reconfigure PXE to make $TESTSERVER boot this image
+#
#ssh liveboot@riserver echo Ok
-ping -c 1 $TESTSERVER
-cat /etc/jenkins/pserver2.ipmi | ipmitool -H 192.168.178.49 -U ADMIN -a chassis power reset
+#
+# reboot TESTSERVER
+#
+cat $TESTSERVER_MGMT_PASSWD_FILE | ipmitool -H $TESTSERVER_MGMT_IP -U ADMIN -a chassis power reset
-sleep 2
-ping -c 1 $TESTSERVER || true
-
-for i in $(seq 1 10) ; do
- sleep 60
+#
+# check for 10min whether it's up again
+#
+for i in $(seq 1 30) ; do
+ sleep 20
if $(ping -c 1 $TESTSERVER >/dev/null) ; then
+ figlet "Ok, pings again..."
break
fi
done
-
if ! $(ping -c 1 $TESTSERVER >/dev/null) ; then
figlet "Warning"
echo "$TESTSERVER still down, please investigate."
exit 1
fi
+#
+# send announce mail
+#
MAIL=$SOURCE_DIR/mail.txt
-MAILTO=liveboot-announce@profitbricks.com
-if [ ! -e $MAIL ]
+if [ ! -e $MAIL ] ; then
figlet "Warning"
- echo "$TESTSERVER still down, please investigate."
+ echo "$MAIL does not exist, something wrong with liveboot-web?"
exit 1
fi
-
cat $MAIL | mail $MAILTO && echo "Mail to $MAILTO send."
cat $MAIL | mail holger@layer-acht.org
+
+#
+# finish
+#
figlet Ok
echo "$TESTSERVER pings again, so we assume it's up."
echo "Please continue manual testing of $(basedir $SOURCE_DIR)"