Linux Today: Linux News On Internet Time.

Problem with continuous monitoring of files with tail command

Dec 29, 2009, 12:29 (0 Talkback[s])

[ Thanks to An Anonymous Reader for this link. ]

"If you can’t get tail command to continuously monitor a file, then read on. I was working on a script yesterday, a part of which depended on continuous monitoring of a text file. I had used our trusty old “tail” command for this but while testing by manually putting in some data into the file, it was failing but curiously it was working fine when used in actual scenario. Befuddled, I did a simple test. I created a simple text file “a.txt” with a few lines of data and then ran the following command:

"...It showed the last few lines of the file and kept waiting. So far so good. Then I opened the file in vim editor, wrote a few more lines, saved the file and then waited but nothing in the window that was running the tail command. Thinking that the data might be buffered and not flushed to the disc yet, I ran the sync command but still nothing."

Complete Story

Related Stories: