[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Skimming files out of a mail folder (semi-procmail related question).
From:       Tony Nugent <tony () trishul ! sci ! gu ! edu ! au>
Date:       1996-11-27 23:12:12
[Download RAW message or body]

On Wed Nov 27 1996, Bill Costa - NIS/CIS - University of New Hampshire wrote:

>     I have a project that will be using procmail to do what it does best,
>     directing certain mail messages into a particular mail folder based on
>     some header criteria (in this case, the "To:" address).
> 
>     While procmail is collecting these messages, every once in a while, 
>     (outside of procmail) I want to process them using an interactive
>     program. My question is; what is the best way to quickly remove the
>     messages from the folder before processing them.  For example, would
>     something like:
> 
>     	% mv foo-folder new-requests		# rename the folder
>     	% touch foo-folder                      # make a new empty one
>     	% my-processor <new-requests		# process last batch of msgs.
> 
>     do the trick -- that is, give me access to the latest batch of messages
>     collected in the foo-folder without messing up procmail and without the
>     possibility of dropping a message on the floor that might happen to
>     arrive while I'm doing the switch-a-roo?  Or is there a better and
>     safer approach to this?
> 
>     Thanks in advance for any and all advice.

You might try delivering them into a directory mh style... if you
specify a directory as the delivery point for a message, then it
assumes that it is an mh mail folder and will add each message to that
directory as a separate file in a numbered sequence.  If you empty
that folder at any time, then the sequence will restart at `1', and no
potential race conditions that you are describing above.

The other thing to do would be to check for the existance of a
procmail lock file for that folder, wait until it disappears if there
is one, create one if/when it doesn't exist, mv/touch it, then finally
rm the lockfile.

Cheers                               .
Tony                             _--_|\ 
    tony@trishul.sci.gu.edu.au  /     *\ T.Nugent@sct.gu.edu.au
    ae.nugent@student.qut.edu.au\_.--._/  tnugent@cit.gu.edu.au
    tony@sctnugen.ppp.gu.edu.au       v  Brisbane Qld Australia
   -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic