Waiting for tomcat to start up in a script

So here’s something that I have found that waits for tomcat to come up but rather than polling or a static time based wait, it uses FIFO pipeline to wait.

Drop this into a tomcat-util.sh file, make it executable and then source the file:

You’ll now have isTomcatUp available as a bash command.


One thought on “Waiting for tomcat to start up in a script

  1. Hi, thanks for this script. Works like a charm. I just have a query (a use case if you will).
    What if grep does not find “INFO: Server startup” in ‘ catalina.out’, then in such a situation will the ‘tail’ end?

    If it does end then how will the calling function know of the failure?

    Hope I make sense.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.