重启Tomcat的脚本
Posted fansik
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了重启Tomcat的脚本相关的知识,希望对你有一定的参考价值。
说明:一台服务器上跑了8个Tomcat
case的方式:
#!/bin/bash #reboot tomcat!!! #Author:fansik echo -e "\033[1;42;31mchoice tomcatNo reboot!!!\033[0m" cat << EOF 1:reboot tomcat8081 2:reboot tomcat8082 3:reboot tomcat8083 4:reboot tomcat8084 5:reboot tomcat8085 6:reboot tomcat8086 7:reboot tomcat8087 8:reboot tomcat8088 EOF read -t 10 -p "Enter a mnumber : " number number=${number:-1} case $number in 1) proId=`ps -ef | grep tomcat8081 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8081 rm -rf logs/* work ./bin/startup.sh exit ;; 2) proId=`ps -ef | grep tomcat8082 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8082 rm -rf logs/* work ./bin/startup.sh exit ;; 3) proId=`ps -ef | grep tomcat8083 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8083 rm -rf logs/* work ./bin/startup.sh exit ;; 4) proId=`ps -ef | grep tomcat8084 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8084 rm -rf logs/* work ./bin/startup.sh exit ;; 5) proId=`ps -ef | grep tomcat8085 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8085 rm -rf logs/* work ./bin/startup.sh exit ;; 6) proId=`ps -ef | grep tomcat8086 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8086 rm -rf logs/* work ./bin/startup.sh exit ;; 7) proId=`ps -ef | grep tomcat8087 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8087 rm -rf logs/* work ./bin/startup.sh exit ;; 8) proId=`ps -ef | grep tomcat8088 | grep java | awk ‘{print $2}‘` kill -9 $proId sleep 5 cd /usr/tomcats/tomcat8088 rm -rf logs/* work ./bin/startup.sh exit ;; *) echo "please input 1-8" esac
以上是关于重启Tomcat的脚本的主要内容,如果未能解决你的问题,请参考以下文章