procmail
[Top] [All Lists]

Re: Only doing stuff for one recipe

1996-11-26 17:16:31
Jason Tang <jasont(_at_)padd(_dot_)press(_dot_)net> writes:
I've got ths following in .procmailrc


:HBhbf
* ^Subject:.*Air Quality Bulletin
| /home/dill/isps/src/air/do_quality > ~/Delphi/air.quality
:HBhbf
* ^Subject:.*Air Quality Bulletin
| /home/dill/isps/src/air/do_level > ~/Delphi/air.level


1) The 'hb' flags, when combined, do nothing.  Take them both out.

2) You have the 'f' flag on those recipes, which means that procmail
        is expecting the actions to be outputing mail messages.  They
        don't, so you shouldn't be putting the 'f' flag on the recipe.

Let's look at what's happening here:


procmail: [13083] Tue Nov 26 19:06:33 1996
procmail: Match on "^Subject:.*Air Quality Bulletin"

Okay, the first recipe's condition matched.


procmail: Executing " /home/dill/isps/src/air/do_quality > 
~/Delphi/air.quality"

procmail fires up $SHELL with arguments "-c" and
"/home/..../air.quality".  The shell execute the do_quality program
with its output redirected to the indicated file.  However the shell's
output will go to procmail REPLACING THE MESSAGE IN PROCMAIL'S
BUFFERS.  That's what the 'f' flag does.

This shell is probably what's generating the "(Resetting uid)" and
"cannot chdir..." messages that eventually show up in your mailbox.
Those messages would seem to indicate that your .procmailrc is being
executed with a current directory of /usr/spool/mqueue.  You should
probably change that at the top of your .procmailrc with an assignment
to MAILDIR.  In addition, I think only csh/tcsh type shells try to do a
chdir early on like that.  Since you shouldn't be using them for
scripting stuff like this, you'll should also put SHELL=/bin/sh near
the top as well.


procmail: No match on "^Subject:.*Air Quality Bulletin"
procmail: No match on "^From:.*<chart-track(_at_)dial(_dot_)pipex(_dot_)com>"
procmail: No match on "^Subject: TV REQ.*"
procmail: No match on "^From: .* <jasont(_at_)padd(_dot_)press(_dot_)net>"
procmail: No match on "^Subject: Use of expired file .*"
procmail: No match on "^To: ijtalk(_at_)madrab(_dot_)demon(_dot_)co(_dot_)uk"
procmail: No match on "^Resent-From: 
procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de"

Since the message is now gone (replaced with "cannot chdir..."), all
these matches fail.


procmail: Locking "/var/spool/mail/jasont.lock"
procmail: [13083] Tue Nov 26 19:06:34 1996
procmail: Assigning "LASTFOLDER=/var/spool/mail/jasont"
procmail: Opening "/var/spool/mail/jasont"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/spool/mail/jasont.lock"

procmail fell off the end of your .procmail, so it's delivering to
$DEFAULT, your mailspool.  Of course, it's just delivering the
shell's error messages, not the original message.

Now that understand (hopefully) why procmail did what it did, let's go
back to your description of what you _wanted_ it to do, and try again.


Which processed a message and redirects output to a file. It is suppose 
to process it twice using two different perl scripts.

Okay, so you want to run two programs across the mail message, without
changing the mail message.  That would indicate you want the 'c' flag
(for "copy") on both of the recipes with the program actions.  Since
the conditions are the same we can 'factor' it out into a nesting
block.  In your original version you used both of the "H" and "B" flags.
Do you *really* expect to see

Subject: Air Quality Bulletin

In the _body_ of a message?  It seems possible, but unlikely.  I'd
suggest that you leave off the "HB" flags for now, and add them only
if a message gets through that shouldn't.

Putting it all together:


# Since your shell was complaining about mqueue, try chdiring to
# somewhere safe before executing anything.
MAILDIR = $HOME

# In fact, don't use tcsh/csh for this, period.
SHELL = /bin/sh


# HB flags would go here if needed
:0
* ^Subject:.*Air Quality Bulletin
{
    # where are the programs?
    PDIR = /home/dill/isps/src/ari

    # Use $HOME instead of 
    :0 c
    | $PDIR/do_quality > $HOME/Delphi/air.quality

    :0 c
    | $PDIR/do_level > $HOME/Delphi/air.level
}


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>