for i in $(curl -s -L cnn.com |egrep --only-matching 'http(s?):\/\/[^ \"\(\)\<\>]*' | uniq) do curl -s -I "$i" 2>/dev/null | head -n 1 | cut -d' ' -f2 done
curl -Is http://www.google.com | head -n 1
HTTP/1.1 200 OK
curl www.websiteToTest.com -s -f -o /dev/null || echo "Website down." | mail -s "Website is down" admin@example.com
Reference: http://unix.stackexchange.com/questions/84814/health-check-of-web-page-using-curl