linux Tomcat/mysql监视器

canca canca
2017-09-29 08:59
4
0

#! /bin/sh

##### tomcat monitor #####

ui=$(ps x |grep catalina |grep tomcat |grep -v grep|awk '{print $1}')

if [ "$ui" == "" ] ;
then

echo "[$(date +'%F %H:%M:%S')] TomcatMonitor starting tomcat.">>/tomcat-monitor.log

#startup tomcat
/mnt/sdb1/software/apache-tomcat-8.0.11/bin/startup.sh

fi

##### mysql monitor #####

ui=$(ps x |grep mysql |grep -v grep|awk '{print $1}')

if [ "$ui" == "" ] ;
then

echo "[$(date +'%F %H:%M:%S')] MysqlMonitor starting MySQL.">>/mysql-monitor.log

#startup mysql
/etc/init.d/mysql start

fi


发表评论