URL Monitor

Short shell script to monitor an URL for change. Sends notification and differences in e-mail.

#!/bin/bash
# Short shell script to monitor an URL for change.
# Sends notification and differences in e-mail.
#
# by Erno Rigo <mcree@tricon.hu>
#
# Licensed under the GPL ;-)
 
FILE="kzblog"
OLDFILE="$FILE.old"
SENDER="devnull@example.com"
RECIPIENT="somebody@somewhere.com"
URL="http://kz71.freeblog.hu/"
 
if [ ! -r $OLDFILE ]; then wget -q -O - "$URL" | html2text -nobs > $OLDFILE; fi
wget -q -O - "$URL" | html2text -nobs > $FILE
diff=`diff $OLDFILE $FILE`
if [ "$diff" ]; then
    echo -e "To: $RECIPIENT\nSubject: $URL changed\nContent-Type: text/plain;\n  charset=iso-8859-1\n\n$diff" | sendmail -F "$SENDER" -f "$SENDER" -r "$SENDER" -i "$RECIPIENT"
    mv -f $FILE $OLDFILE
fi

Linkbacks

Use the following URL for manually sending trackbacks: http://rigo.info/lib/plugins/linkback/exe/trackback.php/en:blog:url_monitor
en/blog/url_monitor.txt · Utolsó módosítás: 2009-04-14 00:00 (külső szerkesztés)
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0