From 97ece25b32276285e76a3ea55e7f1ab57e64cbb5 Mon Sep 17 00:00:00 2001 From: Filip Nguyen Date: Tue, 20 Nov 2018 14:04:42 +0100 Subject: [PATCH] LOG-1638: Fix check for existence of subdomain --- Linux Script/configure-linux.sh | 8 ++++---- Mac Script/configure-mac.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Linux Script/configure-linux.sh b/Linux Script/configure-linux.sh index c0a04ac..ac73b4c 100644 --- a/Linux Script/configure-linux.sh +++ b/Linux Script/configure-linux.sh @@ -354,11 +354,11 @@ checkIfLogglyServersAccessible() { echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid." if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then - if [[ $(curl -L -s --head --request GET $LOGGLY_ACCOUNT_URL/login -w '%{http_code}' -o /dev/null) == "200" ]]; then - echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." + if curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep -q "accounts/invalid" ; then + logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with." + exit 1 else - logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with." - exit 1 + echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." fi else logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with. Please note that your subdomain is just the first string in your loggly account URL not the entire account name." diff --git a/Mac Script/configure-mac.sh b/Mac Script/configure-mac.sh index 4e89cd0..8a1196b 100644 --- a/Mac Script/configure-mac.sh +++ b/Mac Script/configure-mac.sh @@ -234,11 +234,11 @@ checkIfLogglyServersAccessible() { echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid." if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then - if [ $(curl -s --head --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) == 1 ]; then - echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." - else + if curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep -q "accounts/invalid" ; then logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with." exit 1 + else + echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable." fi else logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with. Please note that your subdomain is just the first string in your loggly account URL not the entire account name."