Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 ]
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

Your Answer


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.