linux 项目自动部署脚本

1.使用maven获取源码部署,并可替换配置文件(金融数据分析平台)

#!/bin/bash
#设置变量
cd /home
#停止tomcat
echo "开始停止tomcat..."

ps x | grep java | grep -v grep | awk '{print $1}' | xargs kill -9
#ps x | grep java | grep -v grep | awk '{print $1}'
#ps x | grep java | grep -v grep | kill -9 $1
#echo $1
#kill -9 $1
ps x | grep java | grep -v grep | awk '{print $1}'
sleep 1
echo "tomcat已停止"
echo "========================================================================="
echo "checkout 源代码..."
svn co svn://172.16.16.220/MDMP/trunk/mdmp-all mdmp --username jirauser --password jirauser --no-auth-cache --non-interactive
echo "完成checkout 源代码"
echo "========================================================================="
cd mdmp
echo "开始clean mdmp项目..."
mvn clean

echo "完成clean mdmp项目"
echo "========================================================================="
echo "开始部署个性配置..."
echo "完成个性配置"
echo "开始install mdmp项目..."
mvn install -Dmaven.test.skip=true
echo "完成install fdap项目"
cp -r /home/conf/config.properties mdmp-web/src/main/resources/config.properties
cp -r deploy.sh /home/deploy.sh
cd mdmp-web
echo "开始启动tomcat"
mvn tomcat:run

 

2.tomcat部署新项目 war包,替换配置文件(P2P平台)

#!/bin/bash
#设置变量
cd /home
#停止tomcat
echo "开始停止tomcat..."

ps x | grep java | grep -v grep | awk '{print $1}' | xargs kill -9
#ps x | grep java | grep -v grep | awk '{print $1}'
#ps x | grep java | grep -v grep | kill -9 $1
#echo $1
#kill -9 $1
ps x | grep java | grep -v grep | awk '{print $1}'
sleep 1
echo "tomcat已停止"
echo "========================================================================="
mkdir /p2p/tomcat/war/p2p
echo "========================================================================="
echo "开始解压war包..."
unzip /p2p/tomcat/war/p2p.war -d /p2p/tomcat/war/p2p
echo "解压完成"
echo "========================================================================="
echo "开始部署个性配置..."
cp -r /p2p/tomcat/config/config.properties /p2p/tomcat/war/p2p/WEB-INF/classes/config.properties
echo "完成个性配置"
echo "========================================================================="
echo "删除tomcat目录下p2p项目"
rm -rf /p2p/tomcat/apache-tomcat-6.0.35/webapps/p2p/
echo "删除tomcat目录下p2p项目成功"
echo "========================================================================="
echo "开始移动p2p代码"
mv /p2p/tomcat/war/p2p/ /p2p/tomcat/apache-tomcat-6.0.35/webapps/
echo "移动完成"
echo "开始启动tomcat"
cd /p2p/tomcat/apache-tomcat-6.0.35/bin
./startup.sh
echo "显示启动日志...."
tail -100f /p2p/tomcat/apache-tomcat-6.0.35/logs/catalina.out

 

3.这个脚本只是 一键启动tomcat:停止,启动(无意义,只是方便)

#!/bin/bash
#设置变量
cd /home
#停止tomcat
echo "开始停止tomcat..."

ps x | grep java | grep -v grep | awk '{print $1}' | xargs kill -9
#ps x | grep java | grep -v grep | awk '{print $1}'
#ps x | grep java | grep -v grep | kill -9 $1
#echo $1
#kill -9 $1
ps x | grep java | grep -v grep | awk '{print $1}'
sleep 1
echo "tomcat已停止"
echo "========================================================================="
echo "开始启动tomcat"
cd /p2p/tomcat/apache-tomcat-6.0.35/bin
./startup.sh
echo "显示启动日志...."
tail -100f /p2p/tomcat/apache-tomcat-6.0.35/logs/catalina.out

 

转载于:https://www.cnblogs.com/hutuchong/p/4819193.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值