home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!stanford.edu!ames!data.nas.nasa.gov!ace!jns
- From: jns@ace.nas.nasa.gov (John N. Stewart)
- Subject: Re: How do I tell if a file is open for writing?
- References: <1992Aug20.031946.2150@athena.mit.edu> <1992Aug20.132711.4783@news.eng.convex.com>
- Sender: news@nas.nasa.gov (News Administrator)
- Organization: NAS, NASA Ames Research Center, Moffett Field, CA
- Date: Thu, 20 Aug 92 23:46:43 GMT
- Message-ID: <1992Aug20.234643.27829@nas.nasa.gov>
- Lines: 30
-
- In article <1992Aug20.132711.4783@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
- >From the keyboard of benjy@athena.mit.edu (Benjamin B Thomas):
- >:I was wondering if there is an absolute method of determining if a
- >:file is open for writing. I have been doing:
- >:
- >:ls -s foo > tmp1
- >:sleep 5
- >:ls -s foo > tmp2
- >:cmp tmp1 tmp2
-
- [-stuff deleted-]
-
- >Portable? No. But for those bound and determined, you can
- >dive into the kernel can consult the open file table for
- >entries matching that dev/ino with flags indicating write access.
- >I believe Dan Bernstein's pff program can do this for you.
-
-
-
- I would use the time of last access on a stat command, if you are
- trying to do this in CSH you've got some problems. DO IT IN PERL!
-
- My $0.02 worth -- and since it is as difficult as Tom C. says, and he
- is a Perly guy, I hope he agrees :)
-
- --
- John Stewart (Ace)
- CSS/DSS
- NASA Ames Research Center
- (415) 604-4345
-