[Novalug] 'tail --follow=name filename' to keep tailing the file even if it's recreated (such as due to log rotation)

Doug Toppin dougtoppin@gmail.com
Fri Mar 6 13:33:40 EST 2009


one of the bad things (if there are really any bad things about it)
about using unix/linux for so long is that it's easy to not go back
and browse the man pages every now and then to notice improved command
arguments.  i keep tail running on a tomcat log file on my desktop.
each night log rotation goes and moves it causing a new one to get
created.  if you use 'tail -f name', tail will not "see" the new file
and just sit there forever looking at the old file.
i noticed from 'man tail' that there is a '--follow=name' argument
that tells tail to re-open the file every now and then in case it gets
deleted/recreated.

an example usage is:
tail --follow=name filename

i just thought that i'd pass it along in case anyone else has been
ruthlessly killing and restarting tail every day like i've been for
weeks.

doug



More information about the Novalug mailing list