home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: How do I tell if a file is open for writing?
- Originator: tchrist@pixel.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Message-ID: <1992Aug20.132711.4783@news.eng.convex.com>
- Date: Thu, 20 Aug 1992 13:27:11 GMT
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- References: <1992Aug20.031946.2150@athena.mit.edu>
- Nntp-Posting-Host: pixel.convex.com
- Organization: Convex Computer Corporation, Colorado Springs, CO
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 31
-
- 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
- :...
- :
- :inside of a csh script that looks for files periodically and if they
- :have finished growing, uses them. This would work fine except that the
- :files are coming in over the net, which causes problems when it hangs
- :and the file doesn't grow for awhile.
- :
- :So, if anyone knows of a way to check that a file has actually been
- :closed by whatever was writing it, please let me know.
-
- 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.
-
- Why you want to be doing this in a csh script is beyond me.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- If you have ever seen the grim word "login:" on a screen, your mind
- is now a wholly-owned subsidiary of The Death Star.
- John Woods in <14105@ksr.com> of comp.unix.bsd
-