- 论坛徽章:
- 0
|
本帖最后由 rdcwayx 于 2014-03-20 14:11 编辑
其实主要是想定时查找日志文件下,有没有某些报错....
但报错可能会重复....所以想把旧的报错忽略....
下面是我将现在时间对比日志时间的壳,但没法做到忽略旧的报错- DATE=`date +%Y%m%d`
- TIME=`date +%H%M%S`
- LOCATION=/tmp
- COUNT_LOG=`cut -c-6 $LOCATION/Alarm_log_2014-03-17.log`
- MONITOR_FILE=Alarm_log_2014-03-17.log
- KEYWORD="Set alarm 524"
- FIND_RESULT=`find $LOCATION -name $MONITOR_FILE | xargs grep $KEYWORD`
- if [ "$TIME" - "$COUNT_LOG" <= 100 ]
- then
- if [ "$FIND_RESULT" = "$KEYWORD" ]
- then
- echo 100 > $LOCATION/testing.txt
- echo date >> $LOCATION/logfile.txt && "Error Found out" >> $LOCATION/logfile.txt
- else
- echo 0 > $LOCATION/testing.txt
- echo date >> $LOCATION/logfile.txt && "No Error Found out" >> $LOCATION/logfile.txt
- fi
- else
- echo date >> $LOCATION/logfile.txt && "No Error Found out" >> $LOCATION/logfile.txtl
- fi
复制代码- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::Alarm_log_2014-03-17.log::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- 192536 OTHER MINOR 06213 smtm-scp02 [QM_MAC_G]: EXEC-DB execute {call PKG_QM_API.CCLIS(?,?,?,?,?,?,?,?)} error. rc = -1
- 210406 OTHER INFO 04302 toapp(4K):Set alarm 970
- 210406 OTHER INFO 04303 toapp(4K):Set alarm 971
- 210408 OTHER MAJOR 04352 smtm-scp02 [QM_MAC_G]: DBI-MAJOR Statement execution error at Oracle server - ORA-01480: trailing null missing from STR bind value
- 210408 OTHER MINOR 04353 smtm-scp02 [QM_MAC_G]: EXEC-DB execute {call PKG_QM_API.CCLIS(?,?,?,?,?,?,?,?)} error. rc = -1
- 220223 OTHER INFO 26129 toapp(4K):Set alarm 524
- 220223 OTHER INFO 26129 toapp(4K):Set alarm 0
- 220223 OTHER INFO 26129 toapp(4K):Set alarm 0
- 220225 OTHER MINOR 26219 smtm-cs01-a: Long talking [021E](16-30) detected, asso=[0000], card_no =
- 221530 OTHER INFO 07901 toapp(4K):Set alarm 641
- 221531 OTHER MAJOR 07904 FBCDR alert, Please check the email for detail
- 230425 OTHER INFO 21279 toapp(4K):Clear all alarms
- 234018 OTHER INFO 23344 toapp(4K):Set alarm 524
- 234021 OTHER MINOR 23420 smtm-cs02-a: Long talking [064A](50-10) detected, asso=[03F0].
- 234130 OTHER INFO 24414 toapp(4K):Set alarm 524
- 234130 OTHER INFO 24414 toapp(4K):Set alarm 0
- 234130 OTHER INFO 24414 toapp(4K):Set alarm 0
- 234133 OTHER MINOR 24422 smtm-cs01-a: Long talking [020D](16-13) detected, asso=[0000], card_no =
复制代码 |
|