Jenkins tomcat自动部署脚本

强制关闭tomcat进程,并拷贝包并重新启动tomcat:

export JAVA_HOME=/yougo/java
echo ‘尝试关闭tomcat…’
sh bin/shutdown.sh;
tom_pid=ps -ef|grep group-new|grep -v grep| awk '{print $2}'
#如果tom_pid长度不为零 not-zero
if [ $tom_pid ];
then
echo “tomcat 关闭失败,将强制结束进程:$tom_pid”
kill -9 $tom_pid;
fi
echo “tomcat 进程结束”
echo “清空weapps目录并复制新war包…”
rm -rf webapps/*
cp *.war webapps/;
echo “重新启动tomcat…”
sh bin/startup.sh

你可能感兴趣的:(环境系统)