On Tue, 2 Sep 2003, Louis LeBlanc wrote: > On 09/01/03 04:41 PM, Larry Gilson sat at the `puter and typed: > > Hi Louis, > > > > Please forgive the delay in responding. I was out of touch for a period of > > time. > > Ditto . . . > > > > -----Original Message----- > > > From: Louis LeBlanc > > > > > After rereading a lot of procmail docs, I've found that the exitcode > > > is saved when the 'w' flag is used in the procmail recipe as follows: > > > > I was moving in this very same direction. > > Great minds . . . > > > > :0fw > > > * !^Subject:.*SAtalk > > > | spamc -u "$LOGNAME" > > > > > > Also, the $? variable should hold that exitcode, so following that > > > recipe with > > > > > > SCANNED=$? > > > > > > *should* (meaning untested so far :) cause the following recipe to > > > work only if spamc failed to connect to spamd: > > > > > > :0fw > > > * ? test ! $SCANNED > > > | spamassassin -a > > > > > > That assumes I've gotten the syntax of this last recipe correct - > > > particularly the second line. > > > > I follow you to the end. However, I found references by Philip Guenther > > (Procmail list maintainer) to suggest the following: > > > > > > :0 w > > * ? progname > > | do this if exitcode == 0 > > > > # save the return code in a testable variable > > ret = $? > > > > # Need the 'E' here as ret will contain the return code of > > # the action instead of 'progname' if 'progname' succeeded. > > :0 E > > * ret ?? ^^1^^ > > | do this if exitcode == 1 > > > > :0 E > > * ret ?? ^^2^^ > > | do this if exitcode == 2 > > > > :0 E > > | otherwise, do this > > > > > > If we use that strategy, we might be able to experiment with code as > > follows: > > > > :0fw > > * !^Subject:.*SAtalk > > | spamc -u "$LOGNAME" > > > > SCANNED=$? > > > > :0 Efw > > * SCANNED ?? ^^0^^ > > | spamassassin -a > > I'm pretty sure that wouldn't work. The E causes the second to always > be skipped unless the first didn't execute - like for mail to the SA > list. > > > I was wondering why we could not do the following: > > > > :0 > > * !^Subject:.*Satalk > > { > > :0fw: spamassassin.lock > > * < 256000 > > | spamc > > > > :0 efw: spamassassin.lock > > * < 256000 > > | spamassassin -a > > } > >
You both should just go to the FAQ on the SpamAssassin web and use what's there. Here is my .procmailrc and it's been working fine: VERBOSE=off SENDMAIL=/usr/sbin/sendmail # SpamAssassin sample procmailrc # # Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc' # if you use the spamc/spamd combination) # # The condition line ensures that only messages smaller than 250 kB # (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam # isn't bigger than a few k and working with big messages can bring # SpamAssassin to its knees. # # The lock file ensures that only 1 spamassassin invocation happens # at 1 time, to keep the load down. # :0fw: spamc.lock * < 256000 | spamc # Mails with a score of 15 or higher are almost certainly spam (with 0.05% # false positives according to rules/STATISTICS.txt). Let's put them in a # different mbox. (This one is optional.) :0: * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* almost-certainly-spam # All mail tagged as spam (eg. with a score higher than the set threshold) # is moved to "probably-spam". :0: * ^X-Spam-Status: Yes probably-spam # Work around procmail bug: any output on stderr will cause the "F" in "From" # to be dropped. This will re-add it. :0 * ^^rom[ ] { LOG="*** Dropped F off From_ header! Fixing up. " :0 fhw | sed -e '1s/^/F/' } :0: *^From:.*<[EMAIL PROTECTED]> /dev/null :0: *^Cc:[EMAIL PROTECTED] /home/karl/mail/mine > > Shouldn't the e mean execute if the previous recipe's condition(s) > > matched but there was an error in the action? What do you think? > > I think you're right with that one - using the lowercase 'e', but I'm > not sure how an error is defined there. The procmailrc manpage has > the following: > > e This recipe only executes if the immediately preceding recipe > failed (i.e., the action line was attempted, but resulted in an > error). > > I'd probably go with the following to start off: > > :0 > * !^Subject:.*Satalk > { > :0fw: spamassassin.lock > * < 256000 > | spamc > > SCANNED=$? > > :0fw: spamassassin.lock > * ! SCANNED ?? ^^0^^ > * < 256000 > | spamassassin -a > } > > > By the way, the SA FAQ suggests using a lock. I don't know if spamc > > benefits from the lock but I use it anyway. As you see I'm using the lock because I wasen't told not to...:-) > > # The lock file ensures that only 1 spamassassin invocation happens > > # at 1 time, to keep the load down. > > # > > :0fw: spamassassin.lock > > * < 256000 > > | spamassassin > > Probably a good idea. Even if this is unnecessary, it will probably > reduce the load when dozens of messages come in at once. > > Lou > -- - Karl Larsen k5di Las Cruces,NM Az ScQRPions - ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk