On Fri, Mar 07, 2003 at 07:19:17PM -0800, Jeff Orrok wrote:
My interpretation of the procmailrc man page suggests that I could
test $COMSAT to determine whether the .procmailrc was invoked
manually on the command line or automagically by the MTA; however,
my spider-sense is warning me to be beware of relying on such a side
effect.
The goal is to set some variables with different addresses depending
on whether the .procmailrc is in production or is being tested.
Currently I'm looking for a variable called TEST to be set, but I
don't want to rely on the tester to have to remember it. I definitely
do not want mail going out to live addresses if it is inadvertently
forgotten!! I thought it would be safer to force the tester to
specify TEST=OFF if they want to override the addresses in order send
to live addresses from the command line.
Has anyone tried this, or accomplished the same thing using a better
way?
Better? I think it's a fine way. I've been doing it for almost a year,
under a heavily tested production environment, and it works fine. Not
with COMSTAT, and I actually am not sure from the face of it what you
mean by that part; but with live delivery or not depending on whether
TEST is set.
The only danger I can think of is if your LINEBUF overflowed. I haven't
seen that happen, though, and don't know what the result would be. Mine
is set to 16K. Default is 2K. I actually use both TEST and HARNESS.
Here is setting (or not) the log, from near the top of my working rc:
TRUE = . # normalize Boolean nomenclature
FALSE = ^^^^ # ditto
# . . . .
:0 # set $LOGFILE and $TRAP unless we're running a test harness
* $ HARNESS ?? $FALSE
{
# 021211 () my logs saved by date (per $VARS/genvars); purged by cron
LOGFILE = ${LOGFILE:-$PDIR/logs/$DATE}
TRAP = 'echo "$DATE:$LASTFOLDER" >> mytrap'
}
Later, I deliver in various places based on a SWITCHRC that bails if
we're in test mode. I have had no unwished-for deliveries of live
mail when I'm in test mode, which I am very often.
Here's from one of my delivering SWITCHRCs, near the top:
# if $TEST and no $REDELIVER, vamoose now;
# else, archive a copy, then fall off end to $DEFAULT.
:0 # 030110 () vamoose now if in TEST mode without REDELIVER set
* $ TEST ?? $TRUE
* ! REDELIVER ?? ^^(y|on)
* ! FORCE ?? ^^(y|on)
{ HOST = byebye }
--
dman
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail