在bash脚本的特定时间运行尾-f [英] Run tail -f for a specific time in bash script
本文介绍了在bash脚本的特定时间运行尾-f的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个脚本将运行-f 命令,并将其输出一系列尾到文件中。
我需要的是尾-f
为在一定的时间到grep特定的单词运行。它之所以是一个时间一定是因为有些值不会出现马上,因为这是一个活生生的日志。
我怎么可以运行这样的事情对我们说20秒,输出grep命令,然后继续到下一个命令?
尾-f /例子/日志/审计日志| grep的测试
感谢
解决方案
20超时尾-f /例子/日志/审计日志| grep的测试
I need a script that will run a series of tail -f
commands and output them into a file.
What I need is for tail -f
to run for a certain amount of time to grep specific words. The reason it's a certain amount of time is because some of these values don't show up right away as this is a live log.
How can I run something like this for let's say 20 seconds, output the grep command and then continue on to the next command?
tail -f /example/logs/auditlog | grep test
Thanks
解决方案
timeout 20 tail -f /example/logs/auditlog | grep test
这篇关于在bash脚本的特定时间运行尾-f的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文