in reply to Read entire file then clear while flocking

citycrew:

Can you simply rename it so the mailer can start a new one, and let you process the other one without worrying about locking or hurrying? I don't whack EMail in perl, so there may be some shortcomings to this approach that I haven't thought of.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Read entire file then clear while flocking

Replies are listed 'Best First'.
Re^2: Read entire file then clear while flocking
by citycrew (Acolyte) on Nov 05, 2011 at 05:04 UTC

    Hi Roboticus,

    My fear with doing that was that if mail was being written to the spool file when I try to rename it, it will lose that email. If, however, mv recognizes a locked file then I am golden. Would you happen to know if it does?

      citycrew:

      Sorry, I don't know that. If it's a unix box, though, renaming it won't affect the processes that have it open. So you could potentially rename it and wait a while (giving other jobs a chance to finish using it) and *then* process it. Hopefully someone a bit more knowledgeable about the Unix filesystem will chime in. I'm even less knowledgeable about windows filesystems (except for FAT12/16, yech!)...

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.