procmail
[Top] [All Lists]

RE: how to deliver to a file with a unique time-stamped file name, reliably?

2005-01-19 00:18:30


That said, it is trivial to do this.  simplest way would be to lock
the $MYDATE file and have the script be able to deal intelligently
with multiple mails in the same mbox file, or add a random tag to the
end of the file name.

I was thinking something more like the following:

FIND="TEXT-TO-FIND"
`
:0
* ^TO_user(_at_)domain(_dot_)com
* $ B ?? $FIND
{ 
  # serialize the file create
  :0: create.lock
  {
  # the owner of the lock waits a second,
  # the next one through the gate will wait a second also.
  # this quarantees a unique file name as long as the
  # system admin. doesn't move the clock backwads.
  MYDATE=`sleep 1; date '+%d%m%Y%H%M%S`
  :0c
  $MYDATE
  }

   :0a # process the copy of the mail
   |  /tmp/processmail.sh
}


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail