ssi@usfvax2.EDU (Ssi) (05/13/89)
The other day I had occasion to monitor changes to a file with `tail -f'. I have a shell script that gets input with a read, then does a grep on a `file' with that input, and sends the match to `another_file'. While I was tail -f'ing `another_file' I noticed that some lines did not show up even if the pattern was matched in `file'. Does tail -f do some kind of file lock to prevent writing by another proccess ?? This would seem to defeat it's purpose. SunOS 3.5/BSD 4.2 Greg Ripp (813)628-6100 x5123 ...!uunet!pdn!usfvax2!system1!greg
guy@auspex.auspex.com (Guy Harris) (05/16/89)
>Does tail -f do some kind of file lock to prevent writing by another >proccess ?? No.
jdpeek@RODAN.ACS.SYR.EDU (Jerry Peek) (05/21/89)
In article <1623@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: > >Does tail -f do some kind of file lock to prevent writing by another > >proccess ?? > > No. I didn't see the original article, so I apologize if someone already pointed this out, but it seems like it's important... I think most of the reason for *having* a "tail -f" is to be able to read a file while another process is writing to it. I use this all the time in cases like: % some_slow_process > outputfile & [1] 12345 % tail -f outputfile watch lines from outputfile as outputfile grows... whenever some_slow_process writes a line, I see it I can kill the "tail -f", come back later, start it again... very nice. --Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY jdpeek@rodan.acs.syr.edu, jdpeek@suvm.bitnet +1 315 443-3995