Skip to content

Commit

Permalink
添加部署shell
Browse files Browse the repository at this point in the history
  • Loading branch information
钱继志 committed May 31, 2018
1 parent 7751973 commit 32a4cb0
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
#编译+部署order站点

#需要配置如下参数
# 项目路径, 在Execute Shell中配置项目路径, pwd 就可以获得该项目路径
# export PROJ_PATH=这个jenkins任务在部署机器上的路径

# 输入你的环境上tomcat的全路径
# export TOMCAT_APP_PATH=tomcat在部署机器上的路径

### base 函数
killTomcat()
{
pid=`ps -ef|grep tomcat|grep java|awk '{print $2}'`
echo "tomcat Id list :$pid"
if [ "$pid" = "" ]
then
echo "no tomcat pid alive"
else
kill -9 $pid
fi
}
cd $PROJ_PATH/order
mvn clean install

# 停tomcat
killTomcat

# 删除原有工程
rm -rf $TOMCAT_APP_PATH/webapps/ROOT
rm -f $TOMCAT_APP_PATH/webapps/ROOT.war
rm -f $TOMCAT_APP_PATH/webapps/order.war

# 复制新的工程
cp $PROJ_PATH/order/target/order.war $TOMCAT_APP_PATH/webapps/

cd $TOMCAT_APP_PATH/webapps/
mv order.war ROOT.war

# 启动Tomcat
cd $TOMCAT_APP_PATH/
sh bin/startup.sh



0 comments on commit 32a4cb0

Please sign in to comment.