Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Prcoessing outoput from tail
Brian Candler
3/25/2007 1:00:00 PM
On Sun, Mar 25, 2007 at 07:30:33AM +0900, Phy Prabab 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.
I guess this is a follow-on to this thread:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
Have a look at using "tail -F=<filename>" or "tail -f=<filename> --retry"
within popen.
Screen 1:
$ tail -F /tmp/foo
tail: cannot open `/tmp/foo' for reading: No such file or directory
Screen 2:
$ echo "abc" >/tmp/foo; sleep 3; mv /tmp/foo /tmp/foo2; echo "def" >/tmp/foo
Now Screen 1 shows:
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=<filename>' do that for you :-)
Brian.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Prcoessing outoput from tail
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password