procmail
[Top] [All Lists]

Re: FORWARD file and EXITCODE problem

1997-01-05 20:29:03
Tim <bodysurf(_at_)pobox(_dot_)com> writes:
I have my "~/.forward" file set up like this:

"IFS=' ' && |/usr/local/nuglops/bin/procmail -Yf- || `ksh -c 'echo
~vjl'`/bin/procmail -Yf-"

which (supposedly) provides a "secondary copy" of PROCMAIL.  The principle
is if "/usr/local/nuglops/bin/procmail" doesn't exist (the normal location
of PROCMAIL here at NetCom) for some reason, a secondary or backup copy of
PROCMAIL located in "~vjl/bin/procmail" will be called.  This is to prevent
loss of email should the first copy be down.

Great, I thought, but now something's broke :^(.  SENDMAIL EXITCODE bounces
no longer work.  What happens is the email doesn't get bounced and an email
appears in my box like this (that's it only 2 lines):

<deleted>

Setting EXITCODE tells procmail to return to the shell the number you
give it.  With the "||" syntax, the shell will treat all non-zero exit
codes the same, whether they are due to a failure to exec() if the file
server is down, or procmail returning failure because EXITCODE was set.
The solution is to use some clunkier shell syntax and testing for the
first copy being unavailible directly:

"|IFS=' ';p=/usr/local/nuglops/bin/procmail;if test -f $p; then exec $p -Yf-;
else exec `ksh -c 'echo ~vjl'`/bin/procmail -Yf-; fi"

That should all be on one line of course.

Make sense?

Philip Guenther

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