Showing posts from November, 2012

Bash: check if site is up or down

I have a few self hosted sites and I have been looking for a way to monitor the site statuses in a way that I will get an email when a site is down and another one once that site is back up again. So I decided to write a little bash script that can run on my home linux server. Here is the code: This bash script can also run on Mac or Windows. Bash comes standard on Mac OSX. On windows you will need to install Bash and other GNU tools. I might do a post on how to set this up later. The sendEmail program used in the script did not come standard on my linux box, but it was easily installed with one command line: sudo apt-get install sendemail The sendEmail website can be found here .

Back to basics, back to bash

It had been quite some time since I wrote a bash script, besides the usual one liners I use for getting around my Linux boxes. And it seems to me that unix shell scripting and especially bash scripting is a perfect basis for other scripting languages like perl, python, php and even javascript or xslt. Luckily, on the internet there are some wonderful resources to help learn or get back up to speed with bash scripting. So I figured I'd share some of these.