[Sussex] Ruby file open question
Ronan Chilvers
ronan at thelittledot.com
Tue Nov 1 09:19:44 UTC 2005
Hi Thomas
On Mon, 31 Oct 2005 15:29:11 +0000
Thomas Adam <thomas at edulinux.homeunix.org> wrote:
> On Mon, Oct 31, 2005 at 10:30:20AM +0000, Ronan Chilvers wrote:
> > Hi folks
> >
> > Any rubyers out there know if you can do this (Perl):
>
> Yes.
>
> > open(TAIL, "tail -f /var/log/messages");
> >
> > while(<TAIL>)
> >
> > #do stuff
> >
> > } close(TAIL);
> >
> > but in ruby? I've found and played with the file-tail gem but its
> > very slow to respond to file changes.
>
> The problem with ruby-gems is that it's still in its infancy with
> regards to supplying whats on the RAA [1]. That said, file-tail is
> the way to go. Note that you need to quantify what you mean by
> "slow" in this context. You can specify the delay for the checking
> of the file change. (see File::interval)
I want the script to respond to changes in a logfile fairly quickly.
Currently it takes about 2 or 3 seconds for a change in the logfile to
be picked up by the script... I'll play around with the interval -
thanks for pointing that out.
Cheers
Ronan
--
Ronan
e: ronan at thelittledot.com
t: 01903 739 997
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20051101/9cd9a1e3/attachment.pgp
More information about the Sussex
mailing list