1. 程式人生 > >tomcat Jenkins 上環境部署

tomcat Jenkins 上環境部署

job build usr netstat rep rtu rsync -av sync mvn clean

BUILD_ID=123434353356712222222

if [ netstat -tnulp |grep 8039 |awk -F: ‘{print $4}‘ -eq 8039 ];then
kill -9 netstat -tnulp |grep 8039 |awk ‘{print $NF}‘ |awk -F/ ‘{print $1}‘
fi
rm -rf /usr/local/webserver/tomcat_order.invoice/webapps/order.invoice.war
rm -rf /usr/local/webserver/tomcat_order.invoice/webapps/www
mkdir /usr/local/webserver/tomcat_order.invoice/webapps/www

rsync -avrl target/order.invoice.war /usr/local/webserver/tomcat_order.invoice/webapps/www/
cd /usr/local/webserver/tomcat_order.invoice/webapps/www/
unzip order.invoice.war
rm -rf order.invoice.war
rm -rf /usr/local/webserver/tomcat_order.invoice/work/Catalina/*
sleep 5
chown -R tomcat_server:tomcat_server /usr/local/webserver/tomcat_order.invoice
su - tomcat_server -c "/usr/local/webserver/tomcat_order.invoice/bin/startup.sh"

cd /root/.jenkins/jobs/order_invoice/workspace
mvn clean

tomcat Jenkins 上環境部署