procmail
[Top] [All Lists]

Re: Using 'procmail -m ...' (question)

2004-10-28 15:51:01
On Thu, Oct 28, 2004 at 03:05:38PM -0400, William Park wrote:

On Thu, Oct 28, 2004 at 07:44:08PM +0200, Dallman Ross wrote:
On Thu, Oct 28, 2004 at 12:08:05PM -0400, William Park wrote:

Since my post, I experimented with EXITCODE, and I found that's the key.
Now, I have something like

    EXITCODE=1
    
    :0
    * ...
    { EXITCODE=0 }

    :0
    * EXITCODE ?? 0
    spam
    :0
    /dev/null

I wouldn't recommend doing it that way, just because it's
unnecessarily awkward.

How do you return success (0) or failure, then?  I need that, so I can
test for it in my script, like
    if cat ... | procmail -f - testforspam.rc; then
      ...
    fi
If it also saves the spam headers to a file, that's bonus, because
that's one less line in my script.  At the moment, I have

    EXITCODE=1
    DEFAULT=/dev/null

    :0
    * ...
    { EXITCODE=0 }    # I would have many of these in real recipes

    :0
    * EXITCODE ?? 0
    spam

Well, first of all, procmail normally has an exitcode of zero for
delivery, so I would turn this all around.

How about something like:

         :0:
         * whatever
         spam

         # if we are still here, quit with error exist status
         EXITCODE = 1     HOST


That's the whole recipe.

-- 
dman
         
       

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail