配置tomcat重启脚本
执行命令,重启tomcat
tomcat_home=/usr/local/cohesion/project-test/test/apache-tomcat-8.5.31 #停止tomcat变量 SHUTDOWN=$tomcat_home/bin/shutdown.sh #启动tomcat变量 STARTTOMCAT=$tomcat_home/bin/startup.sh echo "hello" #ps -ef |grep test | grep -v grep |awk '{print $2}'|xargs kill -9 -p PID=`ps -ef |grep usr/local/cohesion/project-test/test/apache-tomcat-8.5.31/conf |grep -v grep | awk '{print $2}'` echo $PID if [ ! "$PID" ];then # 这里判断TOMCAT进程是否存在 echo "进程不存在" else echo "进程存在 杀死进程PID$PID" kill -9 $PID fi $STARTTOMCAT