有人可以告訴我這個腳本有什麼問題,它不起作用。當我運行它時,屏幕上沒有輸出/錯誤。監控腳本不輸出任何東西
腳本是監視一個日誌文件來檢查其中一列的值,如果它超過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中? –
我可以問你是否看過這篇文章的編輯? –