现在的位置: 首页 > 综合 > 正文

tomcat的重启shell脚本

2013年06月03日 ⁄ 综合 ⁄ 共 480字 ⁄ 字号 评论关闭

最近做性能测试,每次测试完成都要重启tomcat,索引很麻烦,为此写了一个简单的shell脚本

#!/bin/sh
#kill tomcat pid
pidlist=`ps -ef|grep tomcat_message_8002|grep -v "grep"|awk '{print $2}'`

if [ "$pidlist" = "" ]
   then
       echo "no tomcat pid alive!"
else
  echo "tomcat Id list :$pidlist"
  kill -9 $pidlist
  echo "KILL $pidlist:"
  echo "service stop success"
fi
echo "start tomcat"

cd /home/app/tomcat_message_8002

rm -rf work/*

cd bin

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

【上篇】
【下篇】

抱歉!评论已关闭.