Simple URL downtime alert with bash, curl and sendmail

17Aug08

Now for a really easy way to be notified when an URL goes down:


email=$(/bin/cat <<!
From: URL Monitor <urlmonitor@localhost>
To: $2
Subject: $1 is down!
!)
/usr/bin/curl -f $1 || echo "$email" | /usr/sbin/sendmail -t

Just put it in your crontab as urlmonitor.sh <URL to check> <email address>.




Where am I?

You are currently browsing the beckr.org | Christian Becker weblog archives for the month August, 2008.

Longer entries are truncated. Click the headline of an entry to read it in its entirety.



www.flickr.com
 
 

About

I'm a partner a MES, a consultancy focused on streaming media, and a PhD student at Free University of Berlin, where we are making the Semantic Web become reality. To learn more about me, check out my resume or my profiles on XING, LinkedIn and Facebook.