#!/bin/sh # This script will check, if a given RSS feed is valid code. # It uses an external online webservice to check validity # Email is sent to admin if: # Feed is invalid # OR: # Feed is valid, but interoperability to many feedreaders could be improved # Send bugs to linuxnetzer-aet-netz10.de ############################################################# # Here goes the feed you want to check. FEED="http://netz10.de/feed" # Here goes the service (external website) we use: SERVICE="http://www.rssboard.org/rss-validator/check.cgi?url=$FEED" # Here we dump the service output (Test results): DUMP="/tmp/rss.dump" # Here goes the email adress to receive the alert: MAILALERT="root" # Alert Header (Subject: ...) ALERTSUBJECT="FEED might be NOT VALID" # Alert Message ALERTMESSAGE="$ALERTSUBJECT Details: $SERVICE" # Here goes your installed textbrowser including argument for dumping TEXTBR="w3m -dump" #TEXTBR="links -dump" ############################################################### # Get feed validation and dump output of result $TEXTBR $SERVICE > $DUMP # Checking $DUMP if $FEED is valid RSS" if # Valid? [ `grep "Congratulations" $DUMP | wc -l` -eq 0 ] || \ # OR: valid, but not 100%, so interoperability could be improved [ `grep "interoperability" $DUMP | wc -l` -gt 0 ] # If one of the two checks above failed, let's send an email ... then echo "$ALERTMESSAGE" mail -s "$ALERTSUBJECT" $MAILALERT << EOF $ALERTMESSAGE EOF # Log invalid feed to syslogd logger "$ALERTMESSAGE" else # If valid, send good news to STDOUT and syslog echo "$FEED is a valid RSS feed" logger "Checked RSS feed $FEED : VALID" fi # Keep your country tidy! So let's clean up a bit... rm $DUMP ############################################################## # written by linuxnetzer # http://netz10.de # Email: linuxnetzer-*at*-netz10.de