首页 > 系统相关 >linux微服务迁移

linux微服务迁移

时间:2022-09-24 18:24:16浏览次数:46  
标签:服务 NAME TOMCAT PORT PKG linux PATH 迁移 WAR

shell脚本 -- 拉取代码包

背景:jenkins上线项目,更新项目包

#!/bin/bash
#====================================================
# Description: Update the package for PE.
#====================================================

PKG_NAME="ROOT"
TOMCAT_PORT="8080"

FTP="ftp://x.x.x.x:21/"
WAR_NAME="${PKG_NAME}.war"
TOMCAT_PATH="/data/tomcat-${TOMCAT_PORT}/webapps/"
BAK_PATH="/data/backup/${PKG_NAME}"

# Create dir.
if [ ! -d "$BAK_PATH" ];then
  mkdir -p "${BAK_PATH}"
fi


# Update package and restart tomcat.
/etc/init.d/tomcat-${TOMCAT_PORT} stop
cd ${TOMCAT_PATH}
cp ${WAR_NAME} ${BAK_PATH}/${WAR_NAME}.$(date +%Y-%m-%d-%H%M.bak)
rm -rf ${TOMCAT_PATH}${PKG_NAME}
rm -rf ${TOMCAT_PATH}${WAR_NAME}
>${TOMCAT_PATH}../catalina.out
#wget ${FTP}/${WAR_NAME}
wget -nH -m --ftp-user=xxx --ftp-password=xxx ${FTP}/${WAR_NAME}
/etc/init.d/tomcat-${TOMCAT_PORT} start
sleep 5

# Check.
echo ""
echo -e "\033[32m=======================Checkout=========================\033[0m"
echo ""
curl -I 127.0.0.1:${TOMCAT_PORT}/${PKG_NAME}
~                                             

 

标签:服务,NAME,TOMCAT,PORT,PKG,linux,PATH,迁移,WAR
From: https://www.cnblogs.com/zeno94/p/16717895.html

相关文章