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
> }
> 
> 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.
>   # 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
-- 
Louis LeBlanc               [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org                     ԿԬ

We must believe that it is the darkest before the dawn of a beautiful
new world.  We will see it when we believe it.
    -- Saul Alinsky


-------------------------------------------------------
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

Reply via email to