I modified the title of my Blog the other day and it reminded me of a little trick I have been using to monitor my website. I received an email alert stating that my website was returning unexpected content. To do this, I created a really basic cron job like this:
MAILTOemail@example.com 3 * * * * if [[ `wget -q -O - https://grepular.com/|grep "Mike Cardwell | Blog"` == "" ]]; then echo "Website response unexepected"; fi
Once an hour it takes a look at https://grepular.com/ and if it doesnâ€™t receive a page that contains “Mike Cardwell | Blog” then it warns me that my website is returning unexpected content and that I should take a look at it. It’s so simple that it can be done entirely inside cron without having to write an external script to do the check.