How could Tomcat be monitored in a bash script to detect that it finished deploying a war or application?
Scenarios:
- Tomcat started with
systemd - Tomcat started with
catalina.sh - Using Tomcat Manager
- Tomcat started from Eclipse
- Embedded Tomcat on SpringBoot
My answer below.
With
systemdIf you start Tomcat with systemctl or catalina.sh uses systemctl something like this could be done. Change
demo.warto your war name, Adjust the sleep period to show as many.(dots) as needed. If it takes 30 secs to deploy, it will show 30 dots.With
catalina.shIf
catalina.sh runfrom Apache package is used (usingcatalina.sh startwill not work)Monitoring log file
Might required permissions to the log file.
If starting tomcat from Eclipse
With Tomcat Manager
With Tomcat manager configured:
With SpringBoot Actuator
If your Spring boot app uses Spring Boot Actuator and is configured as
It can be monitored as: