Skip to content

Instantly share code, notes, and snippets.

@richadams8
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richadams8/8c0d1475410a478da4e2 to your computer and use it in GitHub Desktop.
Save richadams8/8c0d1475410a478da4e2 to your computer and use it in GitHub Desktop.
Script for checking static-edge status
# Credit where credit is due to Nathaniel Landau for the sweet little bash hacks (http://natelandau.com/bash-scripting-utilities/)
bold=$(tput bold)
underline=$(tput sgr 0 1)
reset=$(tput sgr0)
purple=$(tput setaf 5)
red=$(tput setaf 1)
green=$(tput setaf 2)
tan=$(tput setaf 3)
blue=$(tput setaf 4)
e_header() { printf "\n${bold}${purple}========== %s ==========${reset}\n" "$@"
}
e_arrow() { printf "➜ $@\n"
}
e_success() { printf "${green}✔ %s${reset}\n" "$@"
}
e_error() { printf "${red}✖ %s${reset}\n" "$@"
}
e_warning() { printf "${tan}➜ %s${reset}\n" "$@"
}
e_underline() { printf "${underline}${bold}%s${reset}\n" "$@"
}
e_bold() { printf "${bold}%s${reset}\n" "$@"
}
e_note() { printf "${underline}${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$@"
}
check_site() {
e_header "Checking Site: $1"
CURL_COMMAND="curl -k -H 'Host: my.jive.com' https://$2/reports/"
$CURL_COMMAND
echo ""
if [ "$?" == 0 ]; then
e_success "$1 responded"
else
e_error "abnormal response from $1"
fi
echo ${tan}"Command: $CURL_COMMAND"${reset} ${green}"returned: $?"${reset}
echo ""
}
echo ${bold}${underline}${red}"Starting check of static-edge servers"${reset}
echo ${bold}${blue}"Checking round 1"${reset}
check_site "GEG" "162.250.63.20"
check_site "ORD" "199.87.121.20"
check_site "NYC" "162.250.61.20"
echo ${bold}${blue}"Checking round 2"${reset}
check_site "LAX" "162.250.60.20"
check_site "DFW" "199.36.251.20"
check_site "ATL" "162.250.62.20"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment