Created
May 20, 2024 18:47
-
-
Save matheuseduardo/25cc677a9f7520e726788b68a6c75402 to your computer and use it in GitHub Desktop.
check site status bash script
This file contains 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/bash | |
##name: site-status.sh | |
FAIL_CODE=6 | |
check_status(){ | |
LRED="\033[1;31m" # Light Red | |
LGREEN="\033[1;32m" # Light Green | |
NC='\033[0m' # No Color | |
curl -sf "${1}" > /dev/null | |
if [ ! $? = ${FAIL_CODE} ];then | |
echo -e "${LGREEN}${1} is online${NC}" | |
else | |
echo -e "${LRED}${1} is down${NC}" | |
fi | |
} | |
check_status "${1}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment