[opensuse] About tail -f
Hi, I have a bunch of terminals running "tail -f /some/logfile" (directly from the terminal without bash). The problem is that when the logfile is rotated, it does not catch the "new" log. I have to terminate that tail and start another. How could I automate this, another tail program? (on some tail -f terminals I have, rotate works automatically) To be exact, I use this: xfce4-terminal \ --tab --command="/home/cer/bin/terminales_one /var/log/warn" --title="* Warn *" \ --tab --command="/home/cer/bin/terminales_one /var/log/messages" --title=messages \ Where terminales_one is: while true ; do tail -f -n 1000 $1 ; sleep 5 ; done Maybe this is the trick: -f, --follow[={name|descriptor}] output appended data as the file grows; an absent option argument means 'descriptor' -F same as --follow=name --retry So use -F instead? I'm going to try that, but it may take days till I notice if it works or not. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)
10.06.2019 20:48, Carlos E. R. пишет:
Hi,
I have a bunch of terminals running "tail -f /some/logfile" (directly from the terminal without bash). The problem is that when the logfile is rotated, it does not catch the "new" log. I have to terminate that tail and start another.
How could I automate this, another tail program?
(on some tail -f terminals I have, rotate works automatically)
To be exact, I use this:
xfce4-terminal \ --tab --command="/home/cer/bin/terminales_one /var/log/warn" --title="* Warn *" \ --tab --command="/home/cer/bin/terminales_one /var/log/messages" --title=messages \
Where terminales_one is:
while true ; do tail -f -n 1000 $1 ; sleep 5 ; done
Maybe this is the trick:
-f, --follow[={name|descriptor}] output appended data as the file grows;
an absent option argument means 'descriptor'
if you try to read man page to the end it gives you solution. It even explicitly mentions log rotation ...
-F same as --follow=name --retry
So use -F instead?
I'm going to try that, but it may take days till I notice if it works or not.
participants (2)
-
Andrei Borzenkov
-
Carlos E. R.