procmail
[Top] [All Lists]

Re: file locking

1998-02-22 21:04:58
   I have a question about file locking:
   I have the following condition
:0:$HOME/locked
* some condition
$HOME/locked

Are you trying to execute your lockfile?


:0a
sh blahblah $HOME/locked

   I have two questions:  

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

Well, you'll need to have it create a lockfile with a trailing ':', and
you might want to wait for the returned errorcode of the program with
the 'w' flag (but you don't have to).

   :0aw: $HOME/locked
   | blah blah

What does blahblah do?  If you're passing the message to it as a 
filter, you'll need to consider using other flags, like 'f'.

If you need a long lockfile time, extend the default of 1024 seconds
to something else by adding this line:

   LOCKTIMEOUT=$SECONDS

where $SECONDS has been defined as the number of seconds to allow a
lockfile to exist.

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

From procmailrc(5):

       A    This recipe will depend on the last preceding  recipe
            (on  the current block-nesting level) without the `A'
            or `a' flag.  This allows you to chain  actions  that
            depend on a common condition.

       a    Has the same meaning as the `A' flag, but will depend
            on the successful completion of the immediately  pre-
            ceding recipe as well.

Chris

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