"Tail -f" on symlink that points to a file on another drive has interval stops, but not when tailing the original file
14
votes
1
answer
656
views
I'm encountering a strange behaviour with
tail -f
, when tailing a symlink on an Ubuntu machine.
Apparently, tail
uses the default update interval of 1 second. If tailing the original file, it seems to update immediately.
lrwxrwxrwx 1 root root 49 Sep 9 20:28 firewall_log-01.log -> /var/data/log/firewall_log-01.log
Doing
$ tail -f firewall_log-01.log
"pauses" every second (roughly, haven't measured exactly), which fits the defaults for tail:
-s, --sleep-interval=N
with -f, sleep for approximately N seconds (default 1.0)
When doing
$ tail -f /var/data/log/firewall_log-01.log
the output gets updated immediately, apparently not concerned with the default setting for interval.
When I run tail -s 0.01
:
$ tail -f -s 0.01 firewall_log-01.log
I basically have what I need, but I'm still confused by why this even happens.
I can do a workaround by adding an alias to ~/.bashrc
, but this seems like a kind of dirty workaround.
Is there any logical reason for tail to behave like this?
Asked by Whiskeyjack1101
(141 rep)
Sep 11, 2024, 02:05 PM
Last activity: Sep 12, 2024, 08:02 AM
Last activity: Sep 12, 2024, 08:02 AM