tomcat+jenks环境自动部署脚本

脚本1:与jenks连接使用

echo "shut down the server."
tomcat_path=/usr/app/tomcat
project_name=AAA

exec ps -ef|grep java|grep ${tomcat_path}| awk '{print $2}' |xargs -n 1 -r kill -9

sleep 5

echo "server shut down."

rm -rf ${tomcat_path}/work/Catalina/localhost/*

rm -f ${tomcat_path}/logs/catalina.out

rm -rf $tomcat_path/webapps/${project_name}/*

unzip -o ${tomcat_path}/${project_name}.war -d $tomcat_path/webapps/${project_name}

sleep 5

echo "starting the server."

sh ${tomcat_path}/bin/startup.sh

sleep 3

echo "start the server complete"

脚本2:重启tomcat

tomcat_path=/usr/app/tomcat
project_name=AAA

exec ps -ef|grep java|grep ${tomcat_path}| awk '{print $2}' |xargs -n 1 -r kill -9

sleep 2

rm -rf ${tomcat_path}/work/Catalina/localhost/*

rm -f ${tomcat_path}/logs/catalina.out

echo "starting the server."

sh ${tomcat_path}/bin/startup.sh

sleep 3

echo "start the server complete"




你可能感兴趣的:(电脑技术)