[Tfug] Checking for updated webpage
Jeff Breadner
jeff at breadner.ca
Mon Sep 8 13:45:32 MST 2008
> I'm looking for an app that will monitor a specific webpage and inform
> me when it's been updated (the site doesn't provide a feed). I found
> specto, but it wants to pull in the whole GNOME infrastructure. For
> my purposes, a daily cronjob that runs wget and diffs the page might
> be the simplest way. Any suggestions?
>
>
Here's a quickie, untested bash script. It will notify you whenever
something changes, then update the reference point so you won't get
notified again until things change again. It doesn't test for
connectivity, you might want to put a ping test "if" statement around
this, or save the wget output to a file and check if the file size is
zero or something if you need it to be more robust.
cheers
Jeff
#!/bin/bash
OLDMD5SUM="$(cat md5sum.old)"
NEWMD5SUM="$(wget -q - http://myurl.com | md5sum)"
if ! [ "$OLDMD5SUM" = "$NEWMD5SUM" ]
then
echo "$NEWMD5SUM" > md5sum.old
echo "http://myurl.com modified on $(date)" | mail -s
"http://myurl.com modified!" me at mydomain.com
fi
More information about the tfug
mailing list