#!/bin/bash # Define the Tomcat process name TOMCAT_PROCESS="tomcat" # Check if Tomcat process is running if pgrep -x "$TOMCAT_PROCESS" > /dev/null; then echo "Tomcat is running." else echo "Tomcat is not running." # You can add logic here to start Tomcat if desired fi