Check server status along with process id and specific text in log untill 5 minutes
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Check server status along with process id and specific text in log untill 5 minutes
Hi ,
I want to check the server status up and running .
1. Check based upon process id.
2. While checking status Grep specific text in log files untill 5 minutes ,else exit.
3. After start chek if starts or ot
4. After stop check if stops or not
*******I am working below script***************************
Code:
case "$1"in
start )
cd /home/opt/jpo/org
./uikli.sh
;;
Status)
if [ -n "$pid"] ; then
# Here i want to check aso from log.txt for text "pogo Go" this takes 5 minutes to come in log.txt. If this condition is tur then only server is started.
echo "Server is running"
elif [ -z "$pid" ] ; the
echo " Server is stopped "
;;
STOP )
cd /home/opt/jpo/org
./uikli.sh stop
while [ `ps -o pid= -p $pid| wc -l` -ne 0 ] ; do
sleep 1
done
echo " done"
;;
*)
echo"Usage $0 {start|stop|status}
exit 1
;;
esac
Please place your code snippets inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.
It is unclear what you mean by this...
Quote:
Originally Posted by rcroyal88
...I want to check specific text in log file untill 5 minutes and if it can find then its runnng else stopped.
Do you mean you want to look for existence of a specific line in some log file within the previous 5 minutes?
Please be more complete in your question, including which log and an actual example of the line you want to look for.
Please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!
# Here i want to check aso from log.txt for text "pogo Go" this takes 5 minutes to come in log.txt. If this condition is tur then only server is started.
Please be more complete in your question, including which log and an actual example of the line you want to look for.
You have told us nothing at all about how the lines in the file are, or are not timestamped, so it is impossible for anyone to even guess how to test for the 5 minute window.
Again, please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!
Log file looks like this as below
I want my script to check for 5 minutes and search this string "POGO ready" . If it can find this string for 5 minutses else exit
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.