#!/bin/bash ####################################################################################### #Script Name :alertsitedown.sh #Description :send alert email when 200 is not returned #Author :Brian Nelson #Email :brian[at]briansnelson.com ####################################################################################### #Check the Status of a site SC=$(curl --silent -IL $1 -A "Website Checker - https://briansnelson.com/Bash_Script_to_Check_Site_Code_Status_with_Email_Alert" | grep ^HTTP | awk '{print $2}'); ##Now lets check if it gives a 200 if [ "$SC" != "200" ]; then #echo 'Site Error!!!!' echo "Alert for $1 - Error Code $SC" | /usr/bin/mail -s "Alert for $1" 5555555555[at]vzwpix.com else #echo 'Site Working' fi