[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: formail and procmail question



On Sun, 28 Jul 2002 12:48:27 -0600 bob@proulx.com (Bob Proulx) wrote:

Man, you're a tough customer :)

> Carlos Sousa wrote:
> > ...
> > SENDMAIL=/usr/sbin/sendmail   <--------- check your MTA
> 
> You should not have to set SENDMAIL.  When procmail was compiled and
> installed it should have a good setting for this variable by default.

Yes, but Debian is notoriously pro-Exim, and I don't know beforehand
what the procmail package maintainer decided to put in the variable.
This way, I make sure sendmail will be the called MTA.

> ...  Because if you supply your own you also need to keep track
> of this if it is on an old /usr/lib/sendmail or a new /usr/sbin
> version or if elsewhere.

You have a point here. The start of my .procmailrc now reads:

   PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin
   SENDMAIL=sendmail

which transfers responsibility for finding sendmail to the PATH
mechanism, which should always work in a well-configured system anyway.

> >    :0 Hcw                <--------- ":0 Hbcw" to ...
> >    * ^To: echo@.*        <--------- check your specific case
> >    | cat > $ECHOTMP
> 
> :0 Hcw:

You are right, of course. But I didn't add the lock because I tried to
implement your suggestion (below) about allowing simultaneous procmail
processing.

> >   :0 acw
> >   * !^FROM_DAEMON
> > ...
> > 	 cat $ECHOTMP ) | $SENDMAIL -t
> 
> try to avoid the lock to allow simutaneous processing by setting up a
> { } subgrouping subshell, using a unique temporary file with $$ and
> then set up a procmail TRAP to clean up the temporary file.

I changed ECHOTMP to: 

   ECHOTMP=/tmp/echo-reply.$$

and, above the last snippet of code quoted above, I added the line:

   TRAP="rm -f $ECHOTMP"

Though the manpages aren't very clear on this, I believe procmail is
called once per mail message, so ECHOTMP will always be unique for all
messages processed (so no locks needed, and no subshell worries). The
TRAP keyword takes care of the cleaning up.

This seems to work. I just tried two email messages sent in quick
succession from my MUA outbound queue, and checked that the tmp files
had indeed different names and were erased at the end.

Thanks for the help.

-- 
Carlos Sousa
http://vbc.dyndns.org/


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: