Linux 构建打包命令

if [ $ENV == SIT ];then

ln -fs ../DEP-COMMON DEP-COMMON

echo " ======  start  SIT ======================== "

echo "Change SIT configration now"

echo "add common jar file now"

cp -r DEP-COMMON/target/common-0.0.1-SNAPSHOT.jar lib/common-0.0.1-SNAPSHOT.jar

echo "List files under the directory"

#cd $WORKSPACE/lib && ls

echo "Change SIT application properties file now"

cp -r src/main/resources/properties/application_sit.properties src/main/resources/properties/application.properties

echo "Change SIT jdbc properties file now"

cp -r src/main/resources/properties/jdbc_sit.properties src/main/resources/properties/jdbc.properties

echo "delete _.properties"

rm -rf src/main/resources/properties/application_*

rm -rf src/main/resources/properties/jdbc_*

#bash change_common.sh
echo "Change log xml file now"

cp -r src/main/resources/logback.svr.xml src/main/resources/logback.xml

echo "delete logback.xml"

rm -rf src/main/resources/logback.svr.xml

echo " ====== End change_SIT_config shell done  ========================= "

else

#bash change_PROD_config.sh;
ln -fs ../DEP-COMMON DEP-COMMON

echo "======  start PROD ========================"

echo "Change common configration now"

echo "add common jar file now"

cp -r DEP-COMMON/target/common-0.0.1-SNAPSHOT.jar lib/common-0.0.1-SNAPSHOT.jar

echo "List files under the directory"

#cd $WORKSPACE/lib && ls

echo "Change PROD application properties file now"

cp -r src/main/resources/properties/application_prod.properties src/main/resources/properties/application.properties

echo "Change PROD jdbc properties file now"

cp -r src/main/resources/properties/jdbc_prod.properties src/main/resources/properties/jdbc.properties

echo "delete _.properties"

rm -rf src/main/resources/properties/application_*

rm -rf src/main/resources/properties/jdbc_*

echo "Change log xml file now"

cp -r src/main/resources/logback.svr.xml src/main/resources/logback.xml

echo "delete logback.xml"

rm -rf src/main/resources/logback.svr.xml

echo " ======  End change_PROD_config shell done  ========================= "

fi
自动构建部署
if [ $ENV == SIT ];then
echo " ======  start auto deployment SIT 83 ======================== "
mv /app/dep.tar /app/backup/dep.tar$(date +%Y%m%d_%H%M%S)
mv /app/backup/dep.tar /app/dep.tar 
kill -9 $(ps -ef|grep "app/dep" |grep -v grep|awk '{print $2}')
rm -rf /app/dep 
cd  /app && tar -xf dep.tar
find /app/dep/bin/dep -type f |xargs sed -i '/# Attempt to set APP_HOME/i\export JAVA_HOME=\/app\/jdk\/jdk1.8.0_25'
find /app/dep/bin/dep -type f |xargs sed -i 's/exec "$JAVACMD"/exec  nohup "$JAVACMD"/g' && find /app/dep/bin/dep -type f |xargs sed -i 's/DepStartup "$@"/DepStartup "$@" \>\/dev\/null 2\>\&1 \&/g' && cd /app/dep/bin/ && ls && ./dep
 ps -ef | grep "/app"
else
echo " ======  Production environment is not automatically deployed ======================== "
fi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值