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
按字母顺序浏览:A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
→我们致力于为广大网民解决所遇到的各种电脑技术问题 如果您认为本词条还有待完善,请 编辑词条