liuhongyu 发表于 2017-1-16 09:15:53

tomcat的自动重启脚本

#!/bin/sh
#kill tomcat pid

case "$1" in

start)

cd /usr/local/tomcat

#!/bin/sh
#kill tomcat pid

case "$1" in

start)

cd /usr/local/tomcat

rm -rf work/*

cd bin

./startup.sh ;tail -f ../logs/catalina.out
;;
stop)
pidlist=`ps -ef|grep tomcat|grep -v "grep" |grep -v "tomcat_resart.sh" |awk '{print $2}'`


echo "tomcat Id list :$pidlist"


kill -9 $pidlist


echo "KILL $pidlist:"


echo "service stop success"
;;
restart)


pidlist=`ps -ef|grep tomcat|grep -v "grep" |grep -v "tomcat_resart.sh" |awk '{print $2}'`


echo "tomcat Id list :$pidlist"


kill -9 $pidlist


echo "KILL $pidlist:"


echo "service stop success"


echo "start tomcat"


cd /usr/local/tomcat


rm -rf work/*


cd bin


./startup.sh ;tail -f ../logs/catalina.out


;;
*)
echo "Usage: $0 {start|stop|restart}"


exit 1


esac


exit 0
页: [1]
查看完整版本: tomcat的自动重启脚本