Last active
January 22, 2016 02:34
-
-
Save hanksudo/38701693602f85ba3798 to your computer and use it in GitHub Desktop.
Check HTTP status with emoji
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
URIS="""/ | |
/news | |
""" | |
HTTP_OK=0 | |
HTTP_TIMEOUT=0 | |
HTTP_REDIRECTION=0 | |
HTTP_ERROR=0 | |
# Official site | |
for URI in $URIS | |
do | |
if http GET :9100$URI --check-status &> /dev/null; then | |
HTTP_OK=$((HTTP_OK+1)); | |
echo " π "$URI | |
else | |
case $? in | |
2) echo " π΄ "$URI ; HTTP_TIMEOUT=$((HTTP_TIMEOUT+1)) ;; | |
3) echo " π» "$URI ; HTTP_REDIRECTION=$((HTTP_REDIRECTION+1)) ;; | |
4) echo " π‘ "$URI ; HTTP_ERROR=$((HTTP_ERROR+1)) ;; | |
5) echo " π "$URI ; HTTP_ERROR=$((HTTP_ERROR+1)) ;; | |
*) echo " π€ "$URI ; HTTP_ERROR=$((HTTP_ERROR+1)) ;; | |
esac | |
fi | |
done | |
echo "----" | |
echo "\t"π" "$HTTP_OK OKs | |
echo "\t"π" "$HTTP_ERROR Errors | |
echo "\t"π»" "$HTTP_REDIRECTION Redirections | |
echo "\t"π΄" "$HTTP_TIMEOUT Timeouts |
Author
hanksudo
commented
Jan 20, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment