User Tools

Site Tools


linux:checkrest
checkrest() {
URL=$1;
STATUS=$(curl --write-out "%{http_code}" --silent --output /dev/null "$URL")
if [ "$STATUS" != "200" ];
then
mailbody="`date` REST Status Fail (HTTP/$STATUS) $URL" && printf "To: to@janforman.com\nFrom: "Robot" <from@janforman.com>\nSubject: Critical Problem - ($STATUS) $URL\n\n$mailbody" |/usr/sbin/sendmail -f from@janforman.com -Sjanforman.com:25 -aufrom@janforman.com -apPASS to@janforman.com
fi
}

checkrest "http://janforman.com/";
linux/checkrest.txt · Last modified: 2016/08/07 19:38 by Jan Forman