设置监控启动shell脚本


! /bin/bash

这里是你监控脚本的目录

cd /home/
PCOUNT=`ps -ef|grep java|grep cms|grep -v grep|wc -l`
echo $PCOUNT

if [ $PCOUNT -eq 0 ]; then
echo "Starting process…" >> /root/logs/restart.log
echo $(date +"%y-%m-%d %H:%M:%S")-"restart service" >>/root/logs/restart.log
#这个是你启动脚本的目录
sh /home/yxdc/cms/tomcat-8.sh start
else
echo "Process is running!" >> /root/logs/restart.log
fi