Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am tailing a file in unix. It stops working sometimes and I have to re-run the command. Anyone know why this happens?

share|improve this question

migrated from stackoverflow.com Mar 20 '11 at 23:38

This question came from our site for professional and enthusiast programmers.

2 Answers 2

The tail command stops "working" when it reaches the end of the file unless you ask it to follow the file.

The standard "-f" option allows you to follow a file while it grows but if the file is renamed or removed, tail will stick to the file descriptor so updates won't appear unless the process(es) writing to the file have kept it open.

Depending on the tail implementation, you might also have a '-F' option available which will monitor the file by name so won't be confused by the previously mentioned issue.

share|improve this answer

It is possible the file is being turned over due to file size, log files do this a lot. So try to use the -F instead of the -f flag so it follows the file.

Usage: tail -F security.log

share|improve this answer
4  
Did you mean -F? -f will stop when the fill gets removed and recreated. –  Benjamin Bannier Mar 21 '11 at 0:06
    
Thanks ........ –  MrStatic Mar 22 '11 at 19:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.