Re: Logfile roll-over

"Stephen R. van den Berg" <[email protected]> Fri, 21 Apr 2017 11:03:08 +0200
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Lance Dillon wrote:
>What some programs do is not keep the file open, but open it new each time, keeping a pointer to where it was last.?? If you are unable to seek that far, it means the log file has been restarted, and so seek back to the beginning and start over.

What tail --follow does (I think), is keep the file open, but
if the file does not show any new content after
a certain timeout it periodically stats() the file and checks
if the mtime of the file is higher than the last time that it
received something through the open filedescriptor.  If yes,
it then closes and reopens the file.
-- 
Stephen.