Re: [newbie] a program to email upon website changes?

2004-08-03 Thread Todd Slater
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



Re: [newbie] a program to email upon website changes?

2004-07-30 Thread Todd Slater
On Thu, Jul 29, 2004 at 11:41:52PM -0400, g2 wrote:
 folks,
 
 does anyone know of a program, hopefully, appropriate for a linux/mandrake 
 newbie, that will send an email with the text content of a website I specify.
 I know there are various web based services that do this, however none that I 
 have found meet my needs.  Specifically, the site that i need to track is a 
 simple text page, which some of the web services can't seem to deal with, and 
 I want to check it for changes often, like every 15 minutes, many only offer 
 hourly or even daily checking.
 Any thoughts?

I can't help with an program that will email you, but did you know that
Mozilla/Firefox has a feature that will notify you if a bookmarked site you
specify is updated? Go to Manage Bookmarks, click the bookmark you're
interested in, click Properties, and check out Schedule and Nofify.

Also, it should be easy to write a bash script to do what you
want--retrieve the page with wget, compare it to the last version by
running diff or something, if there's no change do nothing, if there is
email yourself an alert.

Todd

-- 
Name that tune #13: When they said come down I threw up.


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