Is there a way to perform a "tail
I currently use tail -f to monitor a log file: this way I get an autorefreshing console monitoring a web server.
Now, said webserver was moved to another host and I have no shell privileges for that. Nevertheless I have a .txt network path, which in the end is a log file which is constantly updated.
So, I'd like to do something like tail -f, but on that url. Would it be possible?In the end "in linux everything is a file" so..
You can do auto-refresh with help of watch
combined with wget
. It won't show history, like tail -f
, rather update screen like top
. Example of command, that shows content on file.txt on the screen, and update output every five seconds:
watch -n 5 wget -qO- http://fake.link/file.txt
Also, you can output n last lines, instead of the whole file:
watch -n 5 "wget -qO- http://fake.link/file.txt | tail"
In case if you still need behaviour like "tail -f" (with keeping history), I think you need to write a script that will download log file each time period, compare it to previous downloaded version, and then print new lines. Should be quite easy.
链接地址: http://www.djcxy.com/p/27280.html上一篇: 调试git的最佳方法
下一篇: 有没有办法执行“尾巴