Timo Maier wrote:
>
> This is the script I've written, not perfect, but works. Maybe someone
> here has a idea to improve this?
It'd probably be best to run the script once per day, on the
"archivedir" contents that were rotated during the previous day. That'd
reduce work a good deal.
There's also no reason to use "cat", or to use grep twice, but you might
consider using mktemp to avoid certain security issues.
#!/bin/bash
bbdir="/var/lib/courier/archive/"
echo "Converting $bbdir"
TMPF="`mktemp /tmp/bdir.XXXXXXXX`"
for i in `find $bbdir -type f`; do
/usr/bin/dspam --user mail --mode=notrain \
--deliver=innocent,spam --stdout \
< "$i" \
| /usr/bin/reformail -f1 > $TMPF
if grep -q -m 1 -e "^X-DSPAM-Confidence: 0\.[8|9]" $TMPF ; then
echo "Spam"
else
cat $TMPF >> mbox
fi
done
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users