On Mon, 2009-09-21 at 23:18 -0400, MySQL Student wrote:
> 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?
> 
Try using a local SA setup for stripping the headers. By local, I mean
don't use your main production SA - run a separate copy with its own
(cut down) configuration and all data base accesses and UBL calls etc
turned off.

By using a separate SA instance you'll avoid access conflicts with your
production SA and by using a minimal configuration it will initialise
and run faster than if it was setting up for a normal scan run.

I have a similar spamc/spamd system that is only used for testing new
local rules. It works well and (important to me anyway) doesn't write
anything to the production maillog, so testing new rules doesn't
contaminate my daily SA performance report.
  
> 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?
> 
I maintain a cleaned spam corpus for developing and regression testing
local rules. I use the following script to delete SA headers from this
corpus:

========================= cleaner ===============================
#!/bin/bash

for f in data/*.txt
do
        echo "Cleaning $f" 
        gawk '
                BEGIN           { act = "copy" }
                /^X-Spam/       { act = "skip" }
                /^[A-WYZ]/      { act = "copy" }
                                {  
                                  if (act == "copy")
                                        { print }
                                }
        ' <$f >temp.txt
        mv temp.txt $f
done
====================== end of cleaner ===========================

This is certainly much faster than using SA for that job: it scans 167
spam messages in 2.3 seconds on a 1.6 GHz Core Duo laptop as compared
with a spamc/spamd run on the same corpus and host, which takes 155
seconds.  


Martin


Reply via email to