On Mon, Sep 24, 2007 at 06:01:16AM +0200, M. Fioretti wrote:
On Sun, Sep 23, 2007 23:52:26 PM +0200, Dallman Ross
(dman(_at_)nomotek(_dot_)com) wrote:
I didn't see your earlier message, but am unclear on why you think
EXITCODE will be helpful to you here.
This is a procmailrc file to be used in a shell script that looks
again at messages already delivered into a maildir via a bash "for"
loop and, with each message does one or more of:
1) delete it
2) move it to another maildir
3) run other scripts, maybe more than one, and do other file-system
related operations depending on the status of the system in that
moment, including what happened with previous messages
Yeah, that part I did see. :-)
In this scenario, do I really need to do this:
MYLOG = /some/file
TRAP = 'echo $MYRECIPE >> "$MYLOG"'
isn't
{
EXITCODE = 1
HOST = byebye
}
the same thing, just faster as it doesn't require grabbing the last
line of MYLOG, but only looking at "$?" ?
It could be. But it depends on a few things. What happens when
you get to EXITCODES that have other meanings and cause other
actions? E.g., on may systems, when you get to EXITCODE 77,
you'll generate a bounce message to the From_ address of the
original message.
Since your mail seems to be stored in maildir++ folders, and since
maildir++ folders typically don't store a From_ header, there is
probably no actual record of a From_ address left, but procmail would
guess based on other headers.
But if you set up non-colliding EXITCODEs, sure, why not.
There are lots of ways to skin this cat. You don't need the TRAP;
it was just one convenient way. You could do this:
NL = '
'
:0
* conditions
{ RECIPE = 1 }
:0 E
* conditions
{ RECIPE = 2 }
:0 E
* conditions
{ RECIPE = 3 }
LOG = "Recipe was $RECIPE$NL"
Or you could do this:
:0
* conditions
{
LOG = "Recipe No. 101
" HOST
}
:0
* conditions
{
LOG = "Recipe No. 102
" HOST
}
:0
* conditions
{
LOG = "Recipe No. 103
" HOST
}
Or you could do this:
:0
* non-scored-conditions
{ RECIPE = 101 SWITCHRC = mylogging.rc }
:0
* non-scored-conditions
{ RECIPE = 101 SWITCHRC = mylogging.rc }
:0
* non-scored-conditions
{ RECIPE = 101 SWITCHRC = mylogging.rc }
And then you'd have your called logging rcfile do:
DEFAULT = /dev/null
NL = '
'
:0
{ LOG = "Recipe No. $RECIPE$NL" }
Yes, it's another file read. It gets cached, and I don't
personally think it's a big hit, but if it's across NFS then
you might think about avoiding it. But if you use the E-flags
as in the first example, you don't need to bother with this
anyway.
I only suggested TRAP because you didn't specify if you were
using a LOGFILE already in your rcfile invoked from the bash
script, is all.
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