I want to tail -f file but going tailing it after a mv.
The tail manpage tells me: -f means --follow=descriptor so a mv should not change the inode?
Why does tail -f stop working after the rename?
I want to tail -f file but going tailing it after a mv.
The tail manpage tells me: -f means --follow=descriptor so a mv should not change the inode?
Why does tail -f stop working after the rename?
Reading tail sources, it appears that it does not fail at reading the renamed file, but it fails at monitoring the file status.
More precisely, tail appears to behave this (simplified) way:
inotify watch in order to be noticed when something happens to the file;When you move the file, inotify informs tail, which in turn decides to drop the file from the list of the monitored files. It appears to be intentional, although it is not clear to me why this is so (and I would expect it to keep monitoring the file after rename). The relevant lines appear to be these.
So, the problem is not with the underlying Linux operating system, but with the way tail handles file renaming.