强制重启tomcat的sh
我写的狗屎 ps aux |grep tomcat_9090_uba |grep -v grep &>/dev/null if [ $? -ne 0 ];then sh /home/tomcat_9090_uba/bin/startup.sh &>/dev/null echo "tomcat9090 start" else ps aux |grep tomcat_9090_uba --color=auto |grep -v grep |awk '{print $2}' |xargs kill -9 && echo "tomcat9090 online" sh /tmp/duidui.sh fi 这。。。唉 ps aux |grep -v grep | grep tomcat_9090_uba &>/dev/null # 如果pid不存在,$?为非零,即直接重启 if [ $? -ne 0 ];then echo "tomcat9090 is not running" sh /home/tomcat_9090_uba/bin/startup.sh &>/dev/null pid=`ps aux |grep -v grep |grep tomcat_9090_uba | awk '{print $2}'` echo "start tomcat9090 successfully, the