Commit 0cd215f9 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Check IP/Port

parent 78555124
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@ rest=${rest#*:}
rest=${rest%%,*}
PORT=${rest%%\"*}

if [ -z "${PORT}" ]; then
  echo "Guest has not set a portnumber yet.."
  exit 1
fi

# Retrieve the IP address

if [[ ! "${RESPONSE}" =~ "eth0" ]] ; then
@@ -34,6 +39,11 @@ rest=${rest#*:}
rest=${rest#*\"}
IP=${rest%%\"*}

if [ -z "${IP}" ]; then
  echo "Guest has not received an IP yet.."
  exit 1
fi

if ! curl -m 3 -ILfSs "http://${IP}:${PORT}/" > /dev/null; then
  echo "Failed to reach ${IP}:${PORT}"
  exit 1