On Tue, Aug 03, 2004 at 01:47:00PM -0400, g2 wrote:
> Clint, Todd,
> 
> Thanks for the suggestions.
> I will check out the scripting tools you mentioned, however they will probably 
> be beyond my skill level.
> Regarding Mozilla's ability to watch a website, yes I have explored that 
> feature.
> BTW, my interest in this has to do with a passion for windsurfing and a 
> related interest in information about weather conditions.  While there are 
> many weather related services available on the internet, I have the best 
> forcast for me is my local NOAA forcast, which you can see here: 
> http://www.srh.noaa.gov/data/BTV/RECBTV
> 
> It is a text only page, as I said the web based services I have seen so far 
> don't seem to be able to deal with anything except html pages.
> 
> NOAA updates this forcast once or twice a day, as conditions change.
> I check it at home, but wanted to see if I could get it emailed to me when it 
> changes.  That way I could recieve the email as a text message on my cell 
> phone.
> 
> Thanks again for your help.

Your first email got me curious so I tried it out as a sort of proof of
concept. Here's the really rough script, modified to take into account
the URL of the page you're looking at. Copy and paste into your editor,
make it executable (chmod +x filename) and run it with "filename url"
Just modify the second line--you should point to a non-existing
directory or an empty one. The idea is to later be able to add more than
one site, but I haven't thought that far ahead yet :) The email part is
left to you for homework. You could add it to cron and have it run every
x minutes.

(I wrote a similar script awhile back to monitor our Blackboard server
when we had issues with it; I just grepped for a phrase that signified
the server needed restarting and ran it every 15 minutes and got emails
if there was a problem and nothing if it was OK.)

Todd

#!/bin/bash
myRoot=/home/todd/.changefiles # <--change this!!
myDist=original
myUrl="$1"

# make sure this directory is empty (or non-existent)
mkdir -p "$myRoot"

#get page
wget -P $myRoot -U Mozilla "$myUrl"

cd $myRoot
# ignore next line; but needed for files like index.html
#rootFile=`ls *.*`
rootFile=RECBTV
echo rootFile is "$rootFile"

rootName=`echo "$rootFile"|cut -d . -f 1`
echo rootName is $rootName

myOrigName=$rootName-$myDist

if [ ! -f $myOrigName ] ;
then
        mv $rootFile $myOrigName
else
        # compare files, use exit status from cmp
        cmp -s $rootFile $myOrigName
        if [ $? == 0 ] ;
        then
                echo "files are identical"
        elif [$? == 1 ] ;
        then
                echo "files are different"
        else
                echo "there was an error"
        fi
        rm $myOrigName
        mv $rootFile $myOrigName
fi

____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to