Skip to content

Instantly share code, notes, and snippets.

@akkunchoi
Created February 16, 2014 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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" sample@example.com
fi
}
# alive http://example.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment