[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tail -f stops working



On Saturday 10 May 2003 05:19, Rob Weir wrote:
[...]
> logrotate rotates your logs at ~6am every day.  Since the
> log file is basically moved to /var/log/blah.log.0 and no one logs to
> it anymore (they reopen /var/log/blah and log to that), tail doesn't get
> any more updates.  I'm sure there's a tool somewhere which can handle
> this, but I've not seen it...

tail --follow=name /var/log/blah.log should do the trick..

<man tail>
<snip/>
With --follow (-f), tail defaults to following the file descriptor, which
means that even if a tail'ed file is renamed, tail will continue to track
its end.  This default behavior is not desirable when you really want to
track the actual name of the file, not the file descriptor (e.g., log
rotation).  Use --follow=name in that case.  That causes tail to track the
named file by reopening it periodically to see if it has been removed and
recreated by some other program
</man>

cheers,
  Johannes

-- 
"More than machinery we need humanity" -- Charlie Chaplin, The Great 
Dictator



Reply to: