procmail
[Top] [All Lists]

Re: set a different exitcode for each mailbox

2007-09-23 13:35:17
On Fri, Sep 21, 2007 16:50:19 PM +0200, Michelle Konzack
(linux4michelle(_at_)freenet(_dot_)de) wrote:

----8<----------------------------------
MAILDIR=${HOME}/.prog_cnf/output
DEFAULT=${HOME}/.prog_cnf/output/

:0f
* some_condition
|some_filter

:0f
* another_condition
|another_filter
----8<----------------------------------

then do in your script:

----8<----------------------------------------------------------
  rm -f ${HOME}/.prog_cnf/output/*/*
  cat ${MSG} |procmail above_procmail_rc
  ES=$?
  if [ ${ES} -eq 0 ] ; then
    FILE=$(ls ${HOME}/.prog_cnf/output/*/* 2>/dev/null)
    ...
    ...
  else
    echo "$(basename $0): procmail exited with error ${ES}" 1>&2
    exit $((127+ES))
  fi
----8<----------------------------------------------------------

which mean. if procmail has filtered without any errors, your
script can pick the resulted file in the DEFAULT directory.

Michelle,

I understand, I think, what the code snippets above do, but in this
case I am not sure they are necessary in my case. As I mentioned, I need
to:

- run procmail, with a special procmailrc, on messages already
  delivered into a temporary maildir by the main procmailrc when they
  arrive. There is no need for another copy of them, is there?

- do the above inside a bash loop, one message at a time. So the
  script calling this procmailrc (with the "cat ${MSG} |procmail
  above_procmail_rc" line) already knows where the message is. It just
  needs to know from procmail which of many recipes matched against
  it.

Given this, isn't is enough to use the EXITCODE / HOST trick mentioned
earlier?

        Thanks,
        Marco

-- 
Help *everybody* love Free Standards and Free Software
http://digifreedom.net/
____________________________________________________________
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