--- mysqlnetworkctl.sh 2007-06-07 16:43:12.000000000 -0400 +++ mysqlnetworkctl-status.sh 2007-07-24 16:04:04.000000000 -0400 @@ -38,6 +38,7 @@ HOSTNAME=`hostname` HTTPD_PIDFILE=/opt/mysql/network/monitoring/apache2/logs/httpd.pid MYSQL_PIDFILE=/opt/mysql/network/monitoring/mysql/data/mysqld.pid +TOMCAT_PIDFILE=/opt/mysql/network/monitoring/apache-tomcat/temp/catalina.pid TOMCAT_ROOTDIR=/opt/mysql/network/monitoring/apache-tomcat unset DISPLAY @@ -61,6 +62,8 @@ MYSQL_PID="" HTTPD_STATUS="" HTTPD_PID="" +TOMCAT_STATUS="" +TOMCAT_PID="" PID="" ERROR=0 @@ -89,6 +92,16 @@ fi } +get_tomcat_pid() { + get_pid $TOMCAT_PIDFILE + if [ ! "$PID" ]; then + return + fi + if [ $PID -gt 0 ]; then + TOMCAT_PID=$PID + fi +} + get_mysql_pid() { get_pid $MYSQL_PIDFILE if [ ! "$PID" ]; then @@ -223,6 +236,7 @@ start_tomcat() { CURDIR="`pwd`" + export CATALINA_PID=$TOMCAT_PIDFILE cd "$TOMCAT_ROOTDIR/bin" ./startup.sh cd "$CURDIR" @@ -230,25 +244,37 @@ stop_tomcat() { CURDIR="`pwd`" + export CATALINA_PID=$TOMCAT_PIDFILE cd "$TOMCAT_ROOTDIR/bin" ./shutdown.sh cd "$CURDIR" } - +is_tomcat_running() { + get_tomcat_pid + is_service_running $TOMCAT_PID + RUNNING=$? + if [ $RUNNING -eq 0 ]; then + TOMCAT_STATUS="tomcat not running" + else + TOMCAT_STATUS="tomcat already running" + fi + return $RUNNING +} help() { echo "usage: $0 help" - echo " $0 (start|stop|restart)" - echo " $0 (start|stop|restart) mysql" - echo " $0 (start|stop|restart) tomcat" - echo " $0 (start|stop|restart) apache" + echo " $0 (start|stop|status|restart)" + echo " $0 (start|stop|status|restart) mysql" + echo " $0 (start|stop|status|restart) tomcat" + echo " $0 (start|stop|status|restart) apache" cat <