#!/bin/bash
. /etc/rc.d/init.d/functions
export JAVA_HOME=/usr/java/jdk1.8.0_111
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
APP_NAME=$1
BUCKUP_DIR=/fs02/backup/spring-cloud/TPP/tpp-${APP_NAME}/$(date +%Y%m%d%H%M)
APP_DIR=/fs01/spring-cloud/TPP
FILE=tpp-${APP_NAME}-3.1.0.jar
[ -z ${BUCKUP_DIR} ] || /bin/mkdir -p ${BUCKUP_DIR}
cd ${APP_DIR}/tpp-${APP_NAME}
tar -cf ${BUCKUP_DIR}/tpp-${APP_NAME}.tar BOOT-INF/ META-INF/
ps aux|grep tpp-${APP_NAME}|grep -v grep |awk '{print $2}'|xargs kill -9
rm -fr ${APP_DIR}/tpp-${APP_NAME}/application.pid
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
#更新tpp-acc账户应用
acc(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
/bin/mv acp_sdk.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
\/bin/mv ../acp_sdk.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-api云通卡
api(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
/bin/mv acp_sdk.properties CaCert.properties cardStroe_Config.properties cardTemplate_Config.properties hct-config.properties netsignagent.properties pay_link.properties ra.jks ra.p7b ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
\/bin/mv ../acp_sdk.properties ../CaCert.properties ../cardStroe_Config.properties ../cardTemplate_Config.properties ../hct-config.properties ../netsignagent.properties ../pay_link.properties ../ra.jks ../ra.p7b ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-channel云通道
channel(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties pay_link.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
/bin/mv channel.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ../pay_link.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
\/bin/mv ../channel.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-message消息推送
message(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
/bin/mv pay_link.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
\/bin/mv ../pay_link.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-mkt营销应用
mkt(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-pay支付应用
pay(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/pay/
/bin/mv acp_applepay_sdk.properties acp_sdk.properties pay_link.properties pay.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/pay/
\/bin/mv ../acp_applepay_sdk.properties ../acp_sdk.properties ../pay_link.properties ../pay.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-pre前置应用
pre(){
/bin/mv application.yml logback-spring.xml ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../application.yml ../logback-spring.xml ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-rcs风控系统
rcs(){
mkt
}
#更新tpp-small小程序
small(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml service_interface.properties twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
/bin/mv pay_link.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../service_interface.properties ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/config/
\/bin/mv ../pay_link.properties ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-spoon云匙应用
spoon(){
/bin/mv applicationContext.xml application.yml db.properties logback-spring.xml twhapi.properties ../
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/spoon/
/bin/mv das-config.properties doorControlPre-config.properties hct-config.properties jdFacePre-config.properties jiadu201710Client.cer ../
cd ${APP_DIR}/tpp-${APP_NAME}
/usr/java/jdk1.8.0_111/bin/jar -xf ${APP_DIR}/tpp-${APP_NAME}/${FILE}
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/
\/bin/mv ../applicationContext.xml ../application.yml ../db.properties ../logback-spring.xml ../twhapi.properties ./
cd ${APP_DIR}/tpp-${APP_NAME}/BOOT-INF/classes/spoon/
\/bin/mv ../das-config.properties ../doorControlPre-config.properties ../hct-config.properties ../jdFacePre-config.properties ../jiadu201710Client.cer ./
/bin/chown -R tomcat8:tomcatg ${APP_DIR}/tpp-${APP_NAME}
cd ${APP_DIR}/tpp-${APP_NAME}/ && ./start.sh
}
#更新tpp-common公用项目
common(){
tar -cf ${BUCKUP_DIR}/tpp-${APP_NAME}.tar tpp-common-3.1.0.jar
ps aux|grep tpp-|grep -v tpp-pre|grep -v grep|awk '{print $2}'|xargs kill -9
find /fs01/spring-cloud/TPP/ -type d -name "lib" ! -path "/fs01/spring-cloud/TPP/tpp-zuul-pre/*" ! -path "${APP_DIR}/tpp-${APP_NAME}/*" -exec cp ${APP_DIR}/tpp-${APP_NAME}/tpp-common-3.1.0.jar {} \;
cd /fs01/spring-cloud/TPP/tpp-acc && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-api && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-channel && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-message && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-mkt && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-pay && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-rcs && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-small && ./start.sh
cd /fs01/spring-cloud/TPP/tpp-spoon && ./start.sh
}
case ${APP_NAME} in
acc)
acc
;;
api)
api
;;
channel)
channel
;;
message)
message
;;
mkt)
mkt
;;
pay)
pay
;;
pre)
pre
;;
rcs)
rcs
;;
small)
small
;;
spoon)
spoon
;;
common)
common
;;
*)
exit 0
;;
esac
转载于:https://www.cnblogs.com/Dev0ps/p/9294088.html