procmail
[Top] [All Lists]

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

2004-10-28 18:28:38
On Fri, Oct 29, 2004 at 12:33:13AM +0200, Dallman Ross wrote:
On Thu, Oct 28, 2004 at 03:05:38PM -0400, William Park wrote:
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.

Yes, much shorter.  I tried it, and it works.

-- 
William Park <opengeometry(_at_)yahoo(_dot_)ca>
Open Geometry Consulting, Toronto, Canada

____________________________________________________________
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