linux - Shellscript to monitor a log file if keyword triggers then execute a command? -
is there cheap way monitor log file tail -f log.txt
, if [error]
appears, execute command?
thank you.
tail -fn0 logfile | \ while read line ; echo "$line" | grep "pattern" if [ $? = 0 ] ... ... fi done
Comments
Post a Comment