[TriLUG] Re: tail across logrotate
James Manning
trilug at sublogic.com
Thu Mar 21 13:57:26 EST 2002
[M. Mueller at Signalnetware.com]
> I want to "tail -f /var/log/myfile &" for weeks at a time. I also logrotate
> /var/log/myfile on a daily basis. When I logrotate, the file handle changes
> and the tail no longer works. I am manually killing/restarting the tail
> process on a daily basis which is tedious since I do this to 5+ systems per
> day.
>
> Any hints on how to automate or otherwise improve this process would be most
> appreciated.
>
> PS: Note my new identity on this list. Yahoo is shutting down POP3 access to
> email accounts so it's bye-bye to bhu5nji.
AFAICT:
while true; do
tail -f --pid=$(cat /var/run/the_daemon.pid) the_daemon.log
done
there's prob. better approaches, but I hate ones that end up increasing
the open/close count on the file more than necessary
James
More information about the TriLUG
mailing list