Currently, the only way to see if my Tomcat has fully started up is to check apache-tomcat log:
tail -f ./catalina.out
and look for this pattern to show up before I do any job.
org.apache.catalina.startup.Catalina.start Server startup in [0-9]* ms
I wanted to automate the process and wrote the script below, which did work.
tail -f ./catalina.out | egrep -q '*.Catalina.start Server startup in [0-9]* ms$' touch done
But the problem is that it sometimes reads the previous Startup and finishes right off.
The desired process:
Tomcat stops -> Tomcat restarts -> The tail shell runs -> Tomcat full starts up -> The shell tells me it's done
What my script might do:
Tomcat stops -> Tomcat restarts -> The tail shell runs -> It immediately tells me Tomcat is fully booted because of the previous log.
How do I achieve this?