[ale] flock

James P. Kinney III jkinney at localnetsolutions.com
Sun Mar 25 23:35:31 EDT 2007


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.
-- 
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