procmail
[Top] [All Lists]

Re: actual problem.

2002-06-13 02:29:23
Now if two mails come simultaneously. It is overwriting the /tmp/mail ,
and thus my script gets confused and didn't work.

OK - there are a number of solutions which don't require timers.

Simplest is to use a lockfile, so there will only be one instance of
your script running at one time, for example:

  :0 : script.lock
  {
    :0 c:
    /tmp/$TIME
    :0 c
    | EX_SCRIPT -w ........$WHOFROM ............../tmp/$TIME .........
  }                    

Other mails will wait to be processed whilst the lockfile 'script.lock'
is held by the recipe.

Alternatively, rather than using a filename based on the time, use a
filename based on the process ID of procmail:

  FILENAME=/tmp/scriptmail-$$
  :0 c
  $FILENAME
  :0 c
  | EX_SCRIPT....$FILENAME

No other process will have that process id whilst procmail is running.

Hope that helps,
Martin
-- 
Martin McCarthy                 /</    http://procmail.non-prophet.org
    `Procmail Companion'        \>\
     Addison Wesley             /</                  PGP key available
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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