[ale] flock

James P. Kinney III jkinney at localnetsolutions.com
Mon Mar 26 07:12:10 EDT 2007


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
-- 
James P. Kinney III          
CEO & Director of Engineering 
Local Net Solutions,LLC        
770-493-8244                    
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part




More information about the Ale mailing list