Any idea to emulate tail -f

  • Thread starter Joel Juvenal Rivera Rivera
  • Start date
J

Joel Juvenal Rivera Rivera

I want to make something very similar to the command tail -f (follow a
file), i have been trying with some while True and some microsleeps
(about .1 s); did someone has already done something like this?

And about the file is the apache acceslog of a site with a lot of
traffic.

Regards

joe / Joel Rivera
 
C

CTO

I want to make something very similar to  the command tail -f (follow a
file), i have been trying  with some while True and some microsleeps
(about .1 s); did someone has already done something like this?

And about the file is the apache acceslog  of a site with a lot of
traffic.

Regards    

joe / Joel Rivera

You might want to try http://pyinotify.sourceforge.net/. Works well on
Linux systems. Otherwise, I'd watch the mtime on the file and fork to
handle the change.

Geremy Condra
 
P

Paul Scott

You might want to try http://pyinotify.sourceforge.net/. Works well on
Linux systems. Otherwise, I'd watch the mtime on the file and fork to
handle the change.

pyinotify works really well. If you need to watch a file, simply use the
IN_MODIFY watch to fire off a notification when the file changes. Then
you can use that event in anything you may need.

I put up some basic pyinotify usage here:
http://www.paulscott.za.net/index.p...ostid=ps123_2560_1240747637&action=viewsingle but if you need some more help with it, read the docs and then ask me also

-- Paul
http://www.paulscott.za.net
http://twitter.com/paulscott56
http://avoir.uwc.ac.za
--
 
I

Iain King

I want to make something very similar to  the command tail -f (follow a
file), i have been trying  with some while True and some microsleeps
(about .1 s); did someone has already done something like this?

And about the file is the apache acceslog  of a site with a lot of
traffic.

Regards    

joe / Joel Rivera

This is very interesting, about using Generator Expressions:
http://209.85.229.132/search?q=cache:ZHrV4E0eTI8J:www.dabeaz.com/generators/Generators.pdf

Relevant stuff about 'tail -f' is on page 39, but I'd read the whole
thing if you can.

Iain
 
J

J Kenneth King

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top