Tailing a log file?

Paul Rubin http
Fri Jun 22 23:27:10 EDT 2007


"Evan Klitzke" <evan at yelp.com> writes:
> I checked the source code for tail and they actually poll the file by
> using fstat and sleep to check for changes in the file size. This
> didn't seem right so I thought about it more and realized I ought to
> be using inotify. So I guess I answered my own question.

If it's just one file, inotify is probably overkill.  I looked into
this recently and ended up just sleeping and trying to read the file
(not bothering with stat; just see if you get 0 bytes back from read).



More information about the Python-list mailing list