0

With lock files I mean: Create a file to lock a resource and delete it when releasing it again.

Ynv
  • 1,824
  • 3
  • 20
  • 29

2 Answers2

4

Directly from the man page:

NOTES
    flock() does not lock files over NFS.  Use fcntl(2) instead: that does work over NFS, given
    a sufficiently  recent version of Linux and a server which supports locking.

I'm not saying using lock files is the better option over NFS, though.

hroptatyr
  • 4,702
  • 1
  • 35
  • 38
1

some reasons not to use flock():

It does not work over NFS.

It is just an advisory lock, even if you use a lock there is no guarantee other processes will respect it.

Colin D
  • 5,641
  • 1
  • 23
  • 35