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 


原文地址:https://www.cnblogs.com/centos2017/p/7896711.html