Hi,

It's certainly not a fast operation, but using the following will
split an mbox into individual messages:

export FILENO=00000
mkdir msgs
formail -s sh -c 'cat - >msgs/$FILENO' < mbox-name.mbox

I also created a loop that would strip all the SA headers from the messages:

for file in *; do echo Processing: $file; spamassassin -d < $file >
$file.txt; done

This worked for a few hundred of the messages, but then started to
fail on my production system with:

[22135] warn: bayes: cannot open bayes databases
/home/user/.spamassassin/bayes_* R/W: lock failed: File exists

How can I tell when another process is using the database and when it
is free for my script to use?

Is there a faster way to run spamassassin just to strip the SA headers?

Maybe there is a faster way, like passing the messages through the
running amavisd instead of having to restart spamassassin each time to
re-process each message?

Thanks,
Alex

Reply via email to