intermachine flocking

Uri Guttman uri at stemsystems.com
Tue Dec 13 16:50:41 GMT 2005


>>>>> "SW" == Simon Wistow <simon at thegestalt.org> writes:

  SW> We have a farm of machines which will have access to a file. We only 
  SW> want one of the machines accessing that file at once - if a process 
  SW> cannot get a lock on the file then it should exit immediately otherwise 
  SW> it shoudl write the necessary number of times to the file and then exit.

  SW> Of course flock() doesn't work across NFS. Is the only solution to this 
  SW> a flock daemon?

mkdir works as an atomic (advisory) lock over nfs. the perl cookbook 1st
ed. has a recipe i studied and rewrote for my needs. the only issue is
possible left over locks after a reboot and those can be cleaned up with
a startup script.

uri

-- 
Uri Guttman  ------  uri at stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


More information about the london.pm mailing list