Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!unhd.unh.edu!al From: al@unhd.unh.edu (Anthony Lapadula) Newsgroups: comp.unix.shell Subject: Creating a lock file in csh? Message-ID: <1991Apr15.205654.26253@unhd.unh.edu> Date: 15 Apr 91 20:56:54 GMT Organization: University of New Hampshire Lines: 18 I'll soon be writing a script (most likely in csh) that has at least one critical section (updating a file). I need to ensure that only one executing copy of the script actually accesses the file at any given time. I had thought that creating a lock file -- and checking for its presence when starting up -- would be a reasonable way to solve the problem. I can't seem to figure out how to do it (short of invoking a C program that invokes open(2) with O_EXCL). We're trying to keep the script machine-independent, so the open(2) solution is out. I looked at mktemp(1), but it also seems insufficient. Lastly, does it matter that we're using NFS? Any and all replies welcome. Thanks in advance. -- Anthony (uunet!unhd!al, al@cs.unh.edu) Lapadula