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(_at_)trishul(_dot_)sci(_dot_)gu(_dot_)edu(_dot_)au / *\
T(_dot_)Nugent(_at_)sct(_dot_)gu(_dot_)edu(_dot_)au
ae(_dot_)nugent(_at_)student(_dot_)qut(_dot_)edu(_dot_)au\_(_dot_)--(_dot_)_/
tnugent(_at_)cit(_dot_)gu(_dot_)edu(_dot_)au
tony(_at_)sctnugen(_dot_)ppp(_dot_)gu(_dot_)edu(_dot_)au v Brisbane
Qld Australia
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-