procmail
[Top] [All Lists]

Re: Procmail Question on more than one log file.

1998-04-03 19:02:58
Say that this is my .procmailrc file:

---------.procmailrc----------------
VERBOSE=yes
LOGFILE=/user/username/.logfile.pr

INCLUDERC=/user/username/rc.user

:0
* ^FROM .*(other-user|more-users)@
* ^To: (_dot_)*Me(_at_)ISP(_dot_)com
{
  :0 c
  /user/username/mailbox

  :0
  |gzip >> /user/username/users.gz

}

------------rc.file--------------

oldfilelog=$LOGFILE
VERBOSE=yes
LOGFILE=/user/username/other-logfile

* ^From: .*(joe|mary|paul)@
* ^To: (_dot_)*Me(_at_)isp(_dot_)com

{

  :0 c
  !other-account(_at_)IPS(_dot_)COM  #forward to another account.

  :0 
  |gzip >> /user/username/other.file.gz

$LOGFILE  #This is when I do not understand, should this be before the
last brack or after.
}

Let me see if I even understand, If the $LOGFILE is placed before the last
brack then only the mail that matched the above will change the logfile
back to the first. but if it does not match then it will (I think) never
get to the bracks and bypass the $LOGFILE and continue with the new
LOGFILE I have given.
is this right....

Anyone got anymore on this?



On Fri, 3 Apr 1998, David W. Tamkin wrote:

Shawn Boone asked,

| I would like to know how I can have it log everything to the first LOGFILE
| but when it hits a RC file to set it up so I can have it log to a new
| LOGFILE just for that mail that matches the RC file. after the mail has
| hit the RC file and loged it to the new LOGFILE, get it to start logging
| everything in the global logfile again.

At the top of each included rcfile,

  oldlogfile=$LOGFILE # store name of main logfile in another variable
  LOGFILE=logfile_for_this_rcfile

Then recipes and assignemnts go after that, and the included rcfiles all end
with this:

  LOGFILE=$oldlogfile # go back to previous logfile as well as previous rcfile

so that when procmail returns to the main rcfile, you'll get the main logfile
back.

Note that this also works when you nest included rcfiles, because whichever
logfile was used by the rcfile you came from will be used when you return
to it.  That's another reason for saving the previous logfile's name in a
variable instead of hard-coding the name of the global logfile.


--
'reality.sys corrupt! reboot universe? (y,n,q):
--

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