做的时候
tail -f /var/log/apache2/access.log
它显示日志然后
Killed
我必须重新执行 tail -f
才能看到新日志。
如何让 tail -f
持续显示日志而不杀死自己?
最佳答案
我要做的第一件事是尝试使用 --follow 而不是 -f。您的问题可能会发生,因为您的日志文件正在轮换。从手册页:
With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail'ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you really want to track the actual name of the file, not the file descriptor (e.g., log rotation). Use --follow=name in that case. That causes tail to track the named file in a way that accommodates renaming, removal and creation.*
关于linux - tail -f 一直显示 "Killed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22988430/