Skip to content

Instantly share code, notes, and snippets.

@matheuseduardo
Created May 20, 2024 18:47
Show Gist options
  • Save matheuseduardo/25cc677a9f7520e726788b68a6c75402 to your computer and use it in GitHub Desktop.
Save matheuseduardo/25cc677a9f7520e726788b68a6c75402 to your computer and use it in GitHub Desktop.
check site status bash script
#!/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