Shell Script 監控 Log File on Linux

shell script監控程式

監控xxx.log檔案並發送信件

tail -fn0 xxx.log | \
while read line ; do
echo “$line” | grep “ERROR”
if [ $? = 0 ]
then
#發信警告系統異常
fi
done