Tail the filename, not the file
Posted
by
Craig Walker
on Super User
See other posts from Super User
or by Craig Walker
Published on 2010-12-26T17:24:01Z
Indexed on
2010/12/26
17:55 UTC
Read the original article
Hit count: 315
In UNIX (OS X BSD to be precise), I have a "tail -f" command on a log file. From time to time I want to delete this log file so I can more easily review it in my text editor.
I delete the file, and then my program recreates it after new activity. However, my tail command (and anything else that was watching the old log file) doesn't update; it's still watching the old, deleted log file.
I think I understand why this is (file names simply being pointers to blocks of file data). I'd like to know how I can work around this. Ideally, my tail command (and anything else I point to the file) would be able to read the data from the new file when the file name has been deleted and recreated.
How would I do this?
© Super User or respective owner