有人可以告诉我这个脚本有什么问题,它不起作用。当我运行它时,屏幕上没有输出/错误。监控脚本不输出任何东西
脚本是监视一个日志文件来检查其中一列的值,如果它超过20则会回显一条消息。
#!/bin/bash
while true ; do
COUNT=`tail -f /monitoring/log.20160121|cut -d" " -f39`
echo $COUNT
if [ $COUNT -gt 20 ] ;then
echo "Count is high"
break
fi
sleep 10
done
我只是计算出COUNT ='tail -f /monitoring/log.20160121|cut -d“”-f39'有问题,但不知道如何解决 – Unixhelp
那么,如果你键入'tail -f/monitoring/log .20160121'在交互式shell中? –
我可以问你是否看过这篇文章的编辑? –