Shell script to email when web page has updates/changed

Some shipping companies don’t have any sort of notification system for when updates happen to packages. For small things, this is probably not a major issue, but when i ordered my huge Patio roof, i needed to be at home when it was being delivered to help unload.

Unfortunately the website did not have any notifications, and the alternative was to hit reload on the page all the time to check. I figured this should be easy to script and so wrote this small shell script to watch the page, and email me if there were any updates


# URL to check
# Temp file to store the tracking page
# Get the page, remove dynamic content of newrelic and diff feedback on that
modified=$(wget -q -O $temp $url ; diff ${temp} ${temp}.1 |grep -v newrelic |grep -v --  "--" |grep -v 8c8 )
# This is a good idea if it has the Last Modified headers, but in my case it didn't
#modified=$(curl -sI "$url" | grep ^Last-Modified)
# set email address
# Check if the modified variable exists and is more than 0 characters
if [[ ! -z "$modified" && ${#modified} -gt 0 ]]; then
    # Email me the changes if there are any
    echo $url has changed  $modified  - modified| mail -s "Tracking Update"  ${email}
    # Copy the recent grab of the page to the second file to compare to next time
    cp ${temp} ${temp}.1

The initial idea was to check for Last-Modified headers, but they did not have those, so i ended up dumping the page to /tmp/trackingcheck and comparing against /tmp/trackingcheck.1 . I had to adapt my diff command to remove the newrelic dynamic content lines, which probably could have been done, but over all the script worked nicely.
I set up a cron task to run that every 10 minutes. If the page has changed, it emails me, and copies the temp file to /tmp/trackingcheck.1

*/10 * * * * /home/velofille/

hacking tweetwall voting with wget and shell scripting

# copious amount of useless comments 3 pages longer than the code should always be at the top of any shell script
# This is so you can run screen and vote for some person lots without looking like some automated voting system
# Feel free to use this, but please keep my name/website etc on it (need the fame ya know)
# I'm not gonna walk you through it, if you dont understand it then dont use it
# Yes im sure you could do better!
# Don't forget to edit it
# Written by Liz Quilty

RAND=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " |cut -c1-4`
if [ $RAND -lt 1200 ]; then RAND_SLEEP=$(($RAND+200)) ; else RAND_SLEEP=$RAND;fi

while [ 1 ] ; do
# the below line wgets the link the 12345 is the users number and the 45 is country number (view web page for these) - Edit this line to reflect user/url
wget --referer= -U Mozilla
sleep $RAND_SLEEP # sleep for random time before voting again