[ale] flock
cfowler
cfowler at outpostsentinel.com
Mon Mar 26 08:35:27 EDT 2007
Isn't flock advisory locking? Maybe vipw uses it? In order for it to
work both programs must use flock.
On Mon, 2007-03-26 at 07:12 -0400, James P. Kinney III wrote:
> Hmm. I ran the following test:
>
> su
> flock -x /etc/passwd -c `sleep 60`
>
> Then from a different window I was _STILL_ able to vipw and save a
> change before the sleep ran out.
>
> So flock from bash does NOT work as desired.
>
> -testing perl's flock next-
>
> On Sun, 2007-03-25 at 23:35 -0400, James P. Kinney III wrote:
> > I need to put an exclusive lock on a couple of files during a process to
> > make sure they are not written to during the script run. I'm unclear on
> > the use of flock within bash.
> >
> > What I _want_ to do is
> >
> > lock file(s)
> > extract data from the locked file
> > do more stuff (i.e. get mtime on locked file, etc)
> > unlock file(s)
> >
> > Reading the man pages on flock are not helping. It _looks_ like:
> >
> > flock -x <file-to-lock> -c <external-script-that-processes-stuff>
> >
> > will do it but I can't figure out a way to test this.
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list