Skip to content

Instantly share code, notes, and snippets.

@akkunchoi
Created February 16, 2014 19:38
Show Gist options
  • Save akkunchoi/9039510 to your computer and use it in GitHub Desktop.
Save akkunchoi/9039510 to your computer and use it in GitHub Desktop.
#!/bin/sh
function http_status(){
curl -LI $1 -o /dev/null -w '%{http_code}\n' -s
}
function alive(){
code=`http_status $1`
if [ "$code" != "200" ]; then
echo "$1 is $code!" | mail -s "[Alert] $1 is $code" [email protected]
fi
}
# alive http://example.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment