RE: Tail -f and select - Again
[email protected] ("Bruce J. McKenzie") Tue, 22 Jan 2002 15:15:30 -0800
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
At 12:05 PM 1/22/02 -0700, Mark Borghardt wrote:
>Thanks for the prompt reply.
>
>I did a bit more testing and think I found an alternate and I think better
>solution.
>
>Instead of just opening the file I:
>
>$pid = open(DATIN,"tail +0 -f $datafile);
>
>and then instead of closing the file I:
>
>system("kill $pid");
>
>I tested it and it works.
>
>Are there any pitfalls with this strategy?
Just a caveat that might be obvious to some but that I forget at least once a year: "tail -f" sometimes misses information.
I was working on a non-Event perl script that wrote to a log file. I tail'ed the file in another xterm, and was mystified to see gaps where I expected output. I had turned autoflush on, but some lines would not show up in the output.
I looked at the logfile (by just restarting the tail -f) and they were present.
Sadly, I wasted an afternoon on this :-/ but that should be good enough for a year or so.
Bruce
---------------
Bruce McKenzie
[email protected]