I am trying to figure out how to perpetually process the output from a
file. That is I continuously want to process output that is appended to
a file and that file could get rolled out at any time. I use popen
w/tail, but this opens the file each time and I have to reprocess all
the files content. Is there a better way to do this or a library that
would help me? I know that I could probably open the file, tack
location, and watch the inode to make sure the file has not been rolled,
but that amounted to a lot of mistakes and I could never get it work
properly.
On Sun, Mar 25, 2007 at 07:30:33AM +0900, Phy P. wrote:
I am trying to figure out how to perpetually process the output from a
file. That is I continuously want to process output that is appended to a
file and that file could get rolled out at any time.
tail: /tmp/foo' has appeared; following end of new file abc tail: /tmp/foo’ has been replaced; following end of new file
def
(read ‘man tail’ for more details. The above example is using tail 5.93
from
GNU coreutils, which comes with Ubuntu Linux 6.06)
I know that I could probably open the file, tack location, and watch
the inode to make sure the file has not been rolled, but that amounted to
a lot of mistakes and I could never get it work properly.
Let ‘tail -F=’ do that for you
Brian.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.