#!/bin/sh # # @(#)procmail_aol 1996/12/19 Anne Bennett # # Download AOL's list of bad sites for blocking spam, # reformat it for our site, and compare it to what # we've got. Report if different, and prepare new file. # # Last modified: 1997/08/07 Anne Bennett PATH=/local/paths:/usr/bin:/sbin:/usr/sbin export PATH thisprog=procmail_aol logger="logger -p mail.info ${thisprog}:" url="http://www.idot.aol.com/preferredmail" cur_rc=/local/etc/procmail/spam/tag-aol new_rc=/local/etc/procmail/spam/NEW.tag-aol mailto="anne" tmp_new=/tmp/${thisprog}.$$.tmp_new tmp_old=/tmp/${thisprog}.$$.tmp_old tmp_diff=/tmp/${thisprog}.$$.tmp_diff all_tmp="${tmp_new} ${tmp_old} ${tmp_diff}" # Start. # ${logger} starting. # Download and format AOL material; note the date and time. # lynx -dump -source ${url} \ | sed -n '/
/,/<\/PRE>/p' \
   | sed -e '/^\n| formail -b -f -A \"$trash_header siteban per-aol\"\n\n",$1)}' \
   > ${tmp_new}
down_date=`date '+%Y/%m/%d %H:%M:%S %Z'`


# Isolate our current AOL-derived material.
#
cat ${cur_rc} \
   | sed -n '/^# ========== AOL-derived material below ==========$/,$p' \
   | tail +2 \
   >> ${tmp_old}


# Are they different?  If not, clean up and exit quietly.
#
diff ${tmp_old} ${tmp_new} > ${tmp_diff}
if [ ! -s ${tmp_diff} ]; then
   # No changes.
   ${logger} no change.
   rm -f ${all_tmp}
   ${logger} end of run.
   exit
fi


# There were changes!  Prepare a new file and notify maintainer.
#
${logger} changes found.
cat ${cur_rc} \
   | sed -n '1,/^# ========== AOL-derived material below ==========$/p' \
   | sed -e "s%^# Last download on .*%# Last download on ${down_date}%" \
   > ${new_rc}
cat ${tmp_new} >> ${new_rc}

${logger} notifying maintainer.
( echo ""
  echo "New AOL procmail data is in ${new_rc}"
  echo ""
  echo "Differences follow:"
  echo ""
  echo "===================================="
  echo ""
  cat ${tmp_diff}
) | mailx -s "New AOL procmail data ready" ${mailto}


# Clean up and leave
rm -f ${all_tmp}
${logger} end of run.
exit