Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Writing to a log file without colliding

by pingo (Hermit)
on Aug 17, 2004 at 12:26 UTC ( #383632=note: print w/replies, xml ) Need Help??

in reply to Writing to a log file without colliding

It should be mentioned that using locks over NFS is bound to end in disappointment, but then again, maybe you aren't. :-)

May work if you are using some new-fangled NFS version, though.
  • Comment on Re: Writing to a log file without colliding

Replies are listed 'Best First'.
Re^2: Writing to a log file without colliding
by amw1 (Friar) on Aug 17, 2004 at 19:19 UTC
    If you are trying to lock a file that's on NFS create a file in a local directory (/tmp perhaps) and do the locks on that file to control access to the NFS file.
      Assuming, of course, that the script is only run on one machine. Nitpicking? Yes. :-)

      I don't know if I've been led correctly on the point but I believe lock-file creation/destruction isn't enough. I think a lock-dir creation/destruction is best for NFS situations (better atomicity from what I've been told).

        locking over NFS is usually pretty sketchy regardless of wether it's a lock on a file or a directory. Unix really doesn't make a huge distinction between a file and a directory anyway, so the atomicness (I love making up words) of a lock on a file vs. directory should be the same.

        There are some NFS server appliances that don't use a unix file system (NetApp for one) where the atomicness may differ a bit.

        It's been quite a long time since I've played with anything other than sharing home directories on NFS so some of my thinking is most likely dated. :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://383632]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2021-01-25 20:48 GMT
Find Nodes?
    Voting Booth?