4 messages in net.sourceforge.lists.courier-usersRe: [courier-users] mbox archive
FromSent OnAttachments
Timo MaierNov 28, 2006 7:42 am 
Gordon MessmerNov 28, 2006 9:51 am 
Timo MaierNov 28, 2006 10:10 am 
Gordon MessmerNov 28, 2006 1:22 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] mbox archiveActions...
From:Gordon Messmer (yiny@eburg.com)
Date:Nov 28, 2006 1:22:00 pm
List:net.sourceforge.lists.courier-users

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