Grepular

Monitor Your Website Automatically From Cron

Written 8 years ago by Mike Cardwell

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:

MAILTO=webmaster@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.

Looking to hire somebody like me? I'm open to offers of full time employment and small contract jobs. Check out my hiring page. You can follow this Blog using RSS or . To read more, visit my blog index.

Feeling generous?BitcoinMoneroZcashPaypal