javascript和JQuery焦点图和代码特效大全
当前最流行的开源CMS网站系统大全
当前位置:主页 > 操作系统 > Linux/Unix >

shell脚本重启Tomcat服务器

来源:IT技术网编辑:一页书发布于:2013-06-29人围观服务器脚本shellTomcat

shell脚本重启Tomcat服务器,具体shell脚本如下:

 

#!/bin/sh
#Author : gudaihui
#Desc : restart tomcat
#Time : 2013-06-05
 
tomcatpath="/usr/local/tomcat-6.0.18/"
tomcatname="tomcat-6.0.18"
tomcatsh="tomcat6.sh"
 
 
if [ $# -ne 1 ]; then
        ps -ef | grep java | grep ${tomcatpath};
        pid=$(ps -ef | grep java | grep ${tomcatpath} | awk '{print $2}')
else
        pid=$1
fi
 
echo -e "Before start ${tomcatpath}, should kill the same run, kill pid ${pid} (yes/no)? \c"
read Confirm
 
case $Confirm in
y|Y|yes|Yes)
        rm -rf ${tomcatpath}work/Catalina/localhost/*
        kill -9 $pid
        rm -f ${tomcatpath}${tomcatname}.pid
        sleep 1
        /etc/init.d/${tomcatsh} start; tail -f ${tomcatpath}logs/catalina.out
        ;;
*)
        echo "Restart ${tomcatpath} is Canneled"
        ;;
esac

服务器,脚本,shell,相关的文章
有时间的话来看看IT界的突发事件