Solved

How to trap a string in a log file

Posted on 2009-04-02
1
272 Views
Last Modified: 2013-12-06
We have an application that takes a while to start-up. We don't make it available until it is completely back up. The only way to tell that it is up is to tail the log file and wait until we see the "Server startup completed" string. The application is started by running a shell script that we created and we would like to modify it so that the script monitors the log file, and when the "Server startup completed" string is encountered, the script will also make the app available.

Any help in figuring out how to do this would be greatly appreciated.
0
Comment
Question by:Jorge Fraser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
flow01 earned 500 total points
ID: 24054252
in ksh
nr_startup_messages=0
while [[ $nr_startup_messages -eq 0 ]] ; do
   nr_startup_messages=`tail -n logfile | grep -c 'Server startup completed'`
   if [ $nr_startup_messages -gt 0 ]
      then
       echo `date` Server startup completed
  else
       echo 'date` Server startup not completed
  fi
  sleep 300 ## wait 5 minutes
done
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question