procmail
[Top] [All Lists]

Re: Procmail Question on more than one log file.

1998-04-03 13:34:46
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.

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