Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!stc!stl!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: comp.unix.shell Subject: Re: Creating a lock file in csh? Message-ID: <1991Apr16.214611.29516@robobar.co.uk> Date: 16 Apr 91 21:46:11 GMT References: <1991Apr15.205654.26253@unhd.unh.edu> <1991Apr15.230427.9231@convex.com> Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 33 tchrist@convex.COM (Tom Christiansen) writes: > I would strongly counsel against using csh. Use a Bourne-compatible shell. Strongly seconded. > Yes, it makes a difference whether you're > using NFS: old assumptions about idempotency of operations (like create > or unlink or O_EXCL) are no longer valid; Actually, I've seen O_EXCL fail on local filesystems too. Never trust O_EXCL, it's a flag from hell. > lockdaemon_from_hell to make these things work. > And anyway, you can't get > to fcntl() from a shell script anyway. Surely NFS can't possibly break link(2) based locks ? I fail to see how *any* Unixoid filesystem can possibly survive AT ALL if link() doesn't work. If it's OK, the original poster can achieve locking at the shell level using the same techniques as C News does. C News provides the necessary program (/etc/link lookalike) for those who haven't got it, and there's even a tutorial on how to do a simple form of reliable locking *portably* under all kinds of Unix. I think the original poster should at least grab pub/c-news/c-news.tar.Z from ftp.cs.toronto.edu and read the file notebook/newslock in there. It's not actually particularly news-specific, more a general purpose simple locking mechanism that *works*, although it does have its shortcomings. -- Ronald Khoo +44 81 991 1142 (O) +44 71 229 7741 (H)