Tomcat failure detect via shell

Team,
I am able to get ERROR message from my shell script, but sometime few severe error happen that tomcat server not started or not responding. How do we can detect it via shell script ?

here is my snippet I used for my case

  tail -n0 -F $catalinaPath | while read line; 
  do
  if echo $line && echo $line | grep -q 'Server startup' ; 
  then
              pkill -9 -P $$ tail > /dev/null 2>&1
              break
  fi
  done

This will basically checks if string "Server statup" found, it will assume server is started successfully, but what if that string is not found? my script will continue infinite time.

Is there any way we can track such thing via script?