Is your site up?

When I cannot reach one of my sites, I do not know if it is my problem, my ISP’s or my hosting provider’s. This is why I use the service down for everyone or just me.

I have written a simple script which uses that service. Its usage is:

$ ./ is up

and the script is:


# 2009 - Rafa Casado -


if [ $numargs -ne 1 ]
        echo "Usage: $0 domain"
        echo "Ex: $0"
        exit 1

IS_UP=`wget -nv -O - "$DOMAIN" 2>&1 | \
       grep "is up"`
if [ $? == "1" ]; then
        echo "$DOMAIN is down"
        echo "$DOMAIN is up"

But I have modified the script to schedule it as a cron job. The modifications are in the if block, which now is:

if [ $? == "1" ]; then
        mail -s "[ALARM] $DOMAIN is down"

I want to check it every hour so the crontab line is:

0 * * * * /path_to_script/

Obviously, the host where you will run the script will not be the one that you want to check ;)

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*Required Fields