procmail
[Top] [All Lists]

Re: lockfile -ml and -mu

1997-08-01 12:00:00
W. Wesley Groleau asked,

| But isn't there a possibility of a timeout with it locked very long?

True; especially if procmail is the MDA, you cannot tell a delivering
procmail to use a different value for its timeout.  (You can tell lockfile,
but its value is not the problem.)  Generally procmail considers a lockfile
stale after 1024 seconds, or just over seventeen minutes.

If it is getting close to seventeen minutes since you started editing the
copy of the mailbox and you aren't done yet, touch the lockfile to update
its modification time.

| I realize in this case the edits are quick, but in general, ....

I'd guess that in general the edits would take less than seventeen minutes
and that the situation you brought up would be fairly rare.

| How about:
| 
| %lockfile -ml
| %mv /var/mail/furu furu.mbox
| %lockfile -mu
| 
| % --- edit furu.mbox here! ---
| 
| %lockfile -ml
| %cat  /var/mail/furu >> furu.mbox
| %mv furu.mbox /var/mail/furu
| %lockfile -mu

Yes ... or the sixth and seventh commands could be these instead if the
sequence of messages in the spool file is not critical (and you are not
using csh ... at least not a csh where you can't use the append redirector
to create a not-yet-existent file).

  %cat furu.mbox >> /var/mail/furu
  %rm -f furu.mbox

On second thought, with both those ifs, just take Wesley's original if you
think there's any chance the edits will last seventeen minutes and four
seconds or longer.

<Prev in Thread] Current Thread [Next in Thread>