Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am planning to write a bash script and run it as a daemon in the background. The script will continuously monitor the tomcat server logs for any exception, error, etc.

When an exception occurs, it will trigger an event and will handle it accordingly (say, by taking java thread dump, etc). I can write the logic on what to do in case of error found in the logs. All I need to know is how to pass information from the daemon to my error handling script.

Could you give me an idea on how to achieve this? Also, any tools which may help me with this task.

Any help will be much appreciated.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You can do this by using shell script

  tail -Fn0 catalina.txt | \
  while read line ; do
    echo "$line" | grep "pattern"
    if [ $? = 0 ]
    then
           sendemail(
    fi
   done
share|improve this answer
    
Thanks Abhishek.. Let me try this from my end. –  curiousguy May 1 '13 at 11:07
    
Thanks again.. it worked. –  curiousguy May 1 '13 at 11:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.