On Tue, 21 Jan 1997, David Epstein wrote:
dbae> Now I want to start writing perl scripts to deal with the
dbae> individual folders which procmail has made for me. But I'm worried
dbae> that procmail will deliver mail to my folder while perl is
dbae> operating on it, thus producing total confusion. So the right
dbae> solution should be to move the folder first to another place,
dbae> under the protection of a lock file.
dbae>
dbae> Finally, here is my question: is there a program that will act
dbae> like Unix mv? If I do mv A B, I need lock file protection for A
dbae> but not for B, because it will be done manually, though there
dbae> would be nothing wrong with lock file protection for B as well,
dbae> which would make it safer to automate the process of dealing with
dbae> the mail. I could write my own little program in sh or perl, but
dbae> I'm nervous of doing something wrong.
dbae>
dbae> The manual for procmail refers to a program called movemail, which
dbae> might be what I want. But it isn't on our system, as far as I can
dbae> ascertain. I'm not a subscriber to this list, so please send email
dbae> direct to me. Thank you.
Movemail should not be required. A small script something like the
following (a specialization of the example given in the lockfile(1) man
page) should suffice:
#!/bin sh
lockfile A.lock
mv A B
rm -f A.lock
my_mbox_script.pl
Depending on your needs, you might want to append to B instead of
overwriting it.
Regards,
--
Rick Troxel Rick_Troxel(_at_)nih(_dot_)gov
rick(_at_)helix(_dot_)nih(_dot_)gov
http://www.dc-sage.org/bios/rick_troxel 301/435-2983
/////////////////////////////////////////////////////////////////
All effort and exertion put forth by man from the fullness of his
heart is worship, if it is prompted by the highest motives and
the will to do service to humanity. --Abdu'l-Baha