procmail
[Top] [All Lists]

Re: Returned Mail

1995-12-07 07:57:19

[65 lines of header snipped]

I am trying to figure out how to create a recipe which will do the
following:

  1. save single message received to a unique filename
  2. execute perl script using that file name as parameter
  3. delete the file after execution of perl script

For 1, use $$ in your creation of a filename.  This will be expanded
into the PID of the current process, so an assignment of

        TMPFILE=/tmp/$USER.$$.procmail

will give you a unique $TMPFILE for the duration of the process, and
no longer.

For 2, use the | command, as specified in procmailrc(5).

For 3, use "rm $TMPFILE".

To use them all together, place the commands in a sub-block by way
of the {...} combinations on the action line, as specified in
procmailrc(5), e.g.,

:0 [flags]:running.lock
* some
* conditions
* here
{
  TMPFILE=/tmp/stuff.$$

  :0 c
  $TMPFILE

  :0
  | (programname $TMPFILE; rm $TMPFILE)
}

This is simplistic and probably bugridden, but that's why you
proofread these things before implementing them.  :-)


Luck++;
Phil

-- 
#include<std/disclaimer.h>               The gods do not protect fools. Fools
finger pedwards(_at_)gamma(_dot_)cs(_dot_)wright(_dot_)edu      are protected 
by more capable fools.
email pedwards(_at_)valhalla(_dot_)cs(_dot_)wright(_dot_)edu                    
        -Larry Niven

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