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 09:31:29 +0800

On Fri, Apr 16, 2010 at 12:57 AM, Bob Proulx <address@hidden> wrote:

> Eric Blake wrote:
> > Clark J. Wang wrote:
> > > In C code I can use lockf(), flock(), semaphore and mutex for locking /
> > > unlocking. Can bash provide some similar mechanisms?
> >
> > man 1 flock
> >
> > If necessary, you may need to install:
> > ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/
>
> 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. Although it provides timeout
mechanism it's still not so convinient.

>
>  http://www.procmail.org/
>
> I tend to use 'mkdir' when I need a semaphore in a shell script.
>
> Bob
>


reply via email to

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