I’ve thrown together a simple shell script that updates your MT-Blacklist from the clearinghouse file using the interval of your choice with a cron job. If you use it, be couteous to his bandwidth and limit the frequency with which you update. I know its simple, so don’t laugh. And if you see something obviously dumb, let me know.
#/bin/sh
# MT-Blacklist Update
# Andy Freed
# freed@myrealbox.com
# http://freed.dyndns.org
#
# This is a very simplistic script to keep the blacklist file
# for Jay Allen's MT-Blacklist plugin for Moveable Type
# see http://www.jayallen.org/projects/mt-blacklist/ for details
# concept: script is run by cron at interval set by user.
# script downloads new script with CURL from url listed above
# uses curl function to overwrite existing list.
##################
# User Defined
##################
# Full Path to blacklist file on your server
path="/Library/WebServer/Rooftop"
# URL for updated blacklist
url="http://www.jayallen.org/comment_spam/blacklist.txt"
if [ -f "$path/blacklist.txt" ]
then
cd $path
#move existing to backup file
mv blacklist.txt blacklist.last
#fetch new file with curl, transfer/failure will be silent
curl -s -O $url
if [ -a "$path/blacklist.txt" ]
then
#remove .last list if successful
rm blacklist.last
else
#replace list if curl failed
mv blacklist.last blacklist.txt
fi
exit 1
else
#fetch new file with curl, transfer/failure will be silent
curl -s -O $url
fi
WHat the Hell????
my sentiments exactly!
Just an FYI: This script will not work. The blacklist.txt file is write-only. It is not used by MT-Blacklist for storage of blacklist entries. They are all stored in the database.
Well, at least I got a chance to brush up on shell scripting again. :)