procmail
[Top] [All Lists]

Re: file locking

1998-02-18 05:03:18
On Tue, 17 Feb 1998 23:26:31 -0600 (CST),
"Matthew G. Saroff" <msaroff(_at_)pca(_dot_)net> wrote:
:0:$HOME/locked
* some condition
$HOME/locked

You are putting yourself in an endless loop here. The lock file is
just a "semamphore" file which, if it exists, prevents Procmail from
continuing. 

1) I need to make sure that $HOME/locked stays locked until blah blah does
   [its] stuff.  How to I make sure that the file stays locked (note, this
   could be as long as 15-20 min).

(You mean "while blah blah does its stuff"?)
  You'd need to set LOCKTIMEOUT to zero or a very high value. Other
than that, this is the perfect case for a regional lock file.

    LOCKFILE=$HOME/locked.lock

    :0
    * some condition
    $HOME/locked

    :0A
    | blah blah blah

    LOCKFILE

The last line here is an assignment, it means essentially the same as
LOCKFILE='' and so purges the regional lock.

2) What is the difference between the "a" and the "A" flag?  I'm not sure.

If the first recipe failed to write to its folder ($HOME/locked above,
like if it was write protected or the disk was full) then it wasn't
successful and :a would not apply, whereas :A only cares whether the
conditions that lead to the attempt to write to the folder were true.
(In the above example, you should probably use :a if "blah blah" is
supposed to expect a new message to have been appended to
$HOME/locked. If it needs to do its thing regardless, keep the :A.)

Hope this helps,

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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