procmail
[Top] [All Lists]

Re: any better way to bail after one try?

2000-01-10 08:00:19
David W. Tamkin wrote:

Say you have an action in your procmail rcfile that, if it's
already being done by another procmail process, you don't
want the current procmail to do it at the same time, but you
don't want it to wait either: what you want is for the
current procmail process not to do it at all if another
procmail is already doing it.  You want this one to skip on
ahead.

... and wants to accomplish this with procmail's own lockfile
mechanism instead of creating and deleting a lockfile manually.

Couldn't one simply check whether the lockfile already exists,
and if not, go into a block where it's created?

        :0 flags
        * conditions
        * ! ? test -f lockfilename
        {
                :0 flags_for_action :lockfilename
                action
        }

This would fail if just between the test and the creation of the
lockfile another procmail interfered and created the lockfile on
its own, but is that danger big enough to worry about? Or am I
overlooking something else?

/HW

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