Xref: utzoo comp.unix.questions:17071 comp.sys.hp:3236 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.unix.questions,comp.sys.hp Subject: Re: How can I tell which users are making a mounted dev "busy" Message-ID: <4604@buengc.BU.EDU> Date: 20 Oct 89 13:33:15 GMT References: <12973@boulder.Colorado.EDU> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.unix.questions Distribution: comp Organization: Boston Univ. Col. of Eng. Lines: 36 In article <12973@boulder.Colorado.EDU> barbour@spot.colorado.EDU (BARBOUR JIM) writes: >I am trying to write write a program (or script) which will alert persons >on NFS filesystems served by my machine that the machine is being shut down. > >I don't need to worry about which machines are being served since we >only export to one other machine. If you did worry (we have from 11 to 14 machines on our NFS, depending on the gremlin du jour, and baby do we ever worry :-) you'd use the showmount(8nfs) command. >However, I have not been able to figure out a way of determining who is >"using" a given file system. This could be anything from sitting in an nfs >directory, to running a program on an nfs directory, to catting a file. No, you should alert everyone logged onto the client machine. Any time after you shut down the server they may try to open something, and then they're either stuck in "nfs server xxxxx not responding" purgatory, or skipped right to process-crash hell, depending on how they've mounted the imported file system. Either way, it's no fun for them. wall(1) comes in handy, if you remember to use rwalld(8c) so the remote machines get the message. (This is all Ultrix stuff. I hope hp/ux is close enough that it helps.) If you have root access to the client, you should also umount(8) the nfs file's mount on the client, in case someone doesn't get the message, doesn't understand the message, or wants to mess with their own minds... Of course, you can't tell who may be sitting in a cwd that's being imported, so you can't umount, so don't. You'll just be leaving them hanging, like they walked off a cliff in a Looney Tunes cartoon. --Blair "Beep beep!"