最近做性能测试,每次测试完成都要重启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
~
~