bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: Can bash provide some mechanism for locking/unlock


From: Clark J. Wang
Subject: Re: Feature request: Can bash provide some mechanism for locking/unlocking?
Date: Fri, 16 Apr 2010 12:05:47 +0800

On Fri, Apr 16, 2010 at 10:52 AM, Bob Proulx <bob@proulx.com> wrote:

> Clark J. Wang wrote:
> > Bob Proulx wrote:
> > > There is also 'lockfile' distributed with 'procmail'.
> >
> > By using `lockfile'  we must make sure that our script will not crash and
> > the file is unlocked when the script exits.
>
> True.  That is true of any of the file based locking methods.  And
> advantage to the flock/lockf based methods such as flock(1).  But I
> almost always have cleanup traps for other reasons and incorporate the
> cleanup there to ensure that the lockfile is removed by the creating
> process when it exits.
>

Yes, cleanup traps are fine.

>
> As far as needing to make sure that your script doesn't crash, well,
> don't you need to do that anyway?  :-)
>

Agree.

>
> > Although it provides timeout mechanism it's still not so convinient.
>
> Beware of the timeout.  That isn't safe and may violate your mutual
> exclusion section.  Actually it almost certainly will violate it.
>
> Bob
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]