shell脚本 监控ps 不存在则重启

监控 tomcat ,如果自动停止了,则重新启动


 

#!/bin/bash

Start=/usr/local/apache-tomcat-8.0.24/bin/startup.sh
Url="/usr/local/jdk1.8.0_51/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-8.0.24/conf/logging.properties -Djava.util.logging.manager=org.apach"
status1=$(ps -ef | grep "$Url" | grep -v 'grep') 

if [ "${status1}X" = "X" ];then 
   $Start          
fi 


 

posted @ 2017-10-12 13:53  乌托邦眺望  阅读(325)  评论(0编辑  收藏  举报