Created
June 27, 2011 14:27
-
-
Save eykanal/1048957 to your computer and use it in GitHub Desktop.
Simple tool using curl, mailx, and a crontab to monitor whether a site is up or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# How many seconds does it usually take your site to respond? | |
sec=2 | |
# Try to download the site to a file | |
curl -s -m $sec example.org > /tmp/dltime | |
# Get size of file | |
a=`wc -m /tmp/dltime | awk '{print $1}'` | |
# If it didn't download, the file will have size of 0 | |
if [ $a -eq 0 ]; then | |
# send me a reminder | |
echo OH SNAP WE\'VE BEEN SLASHDOTTED \ | |
| mailx -s "Server responding slowly" [email protected] | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment