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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -