procmail
[Top] [All Lists]

Re: occasional loop

2004-02-03 10:19:27
On Tue, 3 Feb 2004, Nancy McGough wrote:

But if someone is running spamassassin (as opposed to spamc),
then they probably *do* want to use a lockfile to limit the
number of instances of spamassassin that are running on their
system. Am I correct about this?

Yes, but -- if they're passing a large enough mail volume through
spamassassin that it would be a problem, then they'd be much better off
switching to spamd/spamc.  I use the following to run my own spamd when
there's no system-wide spamd available:

:0
* < 260000
{
 SAPIDFILE=$HOME/.spamassassin/spamd.pid
 SAPID=`cat $SAPIDFILE`
 SAPORT=7726

 # Check if spamd is running, or try to start it, before calling spamc
 :0fw
 * $ 9876543210^0 ? kill -0 $SAPID
 * $ 9876543210^0 ? spamd -d -p $SAPORT -r $SAPIDFILE -P -m 3
 | spamc -p $SAPORT

 # If spamc didn't run, remove third-party SA markup from the message
 :0Efhw : SA.$LOCKEXT
 | spamassassin -d

 # If the message has no markup, it didn't make it through spamd ...
 :0fw : SA.$LOCKEXT
 * ! ^X-Spam-(Status|Checker-Version):
 | spamassassin
}

(Actually, on machines that have GNU-style "killall" I don't bother with
assigning/using $SAPID, I just "killall -0 spamd".)

The extra pass through "spamassassin -d" is paranoia.  :0e is not a useful 
test for spamc because it exits with failure both when the message is spam
and when spamd is unavailable, so you have to check the headers.  If you
have configured a version_tag for spamassassin it's probably sufficient to
check for that in the third recipe and drop the second.

No-prize for figuring out why I chose port number 7726.  Of course if two
people on the same host try exactly this technique, one of them is going
to have to use a different port number.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>