Software to monitor domains

Ray Parrish crp at cmc.net
Mon Nov 17 06:43:07 UTC 2008


Ray Parrish wrote:
> Derek Broughton wrote:
>   
>> You won't find a Linux packaged solution to just do that because it's as 
>> simple as running a script that uses "wget" to get anything from the 
>> site (outputting it to /dev/null) and echos a message if wget fails, 
>> being careful to create no output at all when the wget succeeds.  Stick 
>> the script in cron, and you'll get an email every time it fails.
>>   
>>     
>
>
>   
Hello,

Well, it took me a little while, but I've come up with a solution that 
seems to work. Following is my code for two scripts I created. One 
starts the polling of the web site, and the other stops the polling script.

[start of PollWebSite.sh]
#!/bin/sh
cd ~/SiteCheck
touch go.txt
while [ -e go.txt ]
do
    wget --connect-timeout=20 "$1" 2>/dev/null || xmessage "$1 is down";
    rm index.html
    sleep 10;
done
xmessage "Exiting Poll Web Site"
[end of PollWebSite.sh]

[start of StopPoll.sh]
#!/bin/sh
cd ~/SiteCheck
rm go.txt
[end of StopPoll.sh]

I'm going to change the polling interval in actual use, I set it to loop 
fast so I could test the loop exit to be sure it worked. I of course 
created a folder named ~/SiteCheck first, but a person could add that to 
the script as well.

Later, Ray Parrish

-- 
http://www.rayslinks.com/ Web index of human reviewed links.
<http://www.rayslinks.com/Troubleshooting%20and%20fixing%20Windows.html>
Trouble shooting and Fixing Windows
http://www.writingsoftheschizophrenic.com My poetry in web pages





More information about the ubuntu-users mailing list