script to automatically test if a web site is available

Posted by Xoundboy on Server Fault See other posts from Server Fault or by Xoundboy
Published on 2011-06-20T14:37:46Z Indexed on 2011/06/20 16:25 UTC
Read the original article Hit count: 257

Filed under:
|
|
|
|

I'm a lone web developer with my own Centos VPS hosting a few small web sites for my clients. Today I discovered my httpd service had stopped (for no apparent reason - but that's another thread). I restarted it but now I need to find a way that I can be notified by email and/or SMS if it happens again - I don't like it when my client rings me to tell me their web site doesn't work!

I know there are probably many different possibilities, including server monitoring software. I think all I really need is a script that I can run as a cron job from my dev host (which is permanently running in my office) that attempts to load a page from my production server and if it doesn't load within say 30 seconds then it sends me an email or SMS. I'm pretty rubbish at shell scripting, hence this question.

Any suggestions would be gratefully appreciated, thanks to all you clever sysadmin guys and girls out there :)

© Server Fault or respective owner

Related posts about bash

Related posts about cron