码迷,mamicode.com
首页 > 其他好文 > 详细

重启Tomcat的脚本

时间:2016-06-23 18:54:25      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

说明:一台服务器上跑了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的脚本

标签:

原文地址:http://www.cnblogs.com/fansik/p/5611774.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!