From a2f2ed236999f218e4ce9ce77a56e0e96871c722 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 15 Jul 2024 16:23:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E7=A9=BA=E9=A1=B9=E7=9B=AE=E6=89=93?= =?UTF-8?q?=E5=8C=85=E8=84=9A=E6=9C=AC0.2=20=E6=96=B0=E5=A2=9E=E7=99=BB?= =?UTF-8?q?=E9=99=86=E5=92=8C=E6=94=AF=E4=BB=98=E6=9C=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shikong.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++- update_sk_login.sh | 20 +++++++++++++++++++ update_sk_pay.sh | 21 ++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 update_sk_login.sh create mode 100644 update_sk_pay.sh diff --git a/shikong.sh b/shikong.sh index e25ac2b..620f7dc 100644 --- a/shikong.sh +++ b/shikong.sh @@ -150,6 +150,52 @@ game_server_option(){ esac } +# 通用的更新函数 +normal_code_update() { + local server_name=$1 + echo -e "${yellow}${server_name}更新${NC}" + read -rp "请输入要更新的ip地址: " ip + echo -e "开始更新${server_name},ip:$ip" + case $server_name in + "login") + bash ./update_sk_login.sh $ip + ;; + "pay") + bash ./update_sk_pay.sh $ip + ;; + *) + echo -e "更新服务不存在!" + exit 0 + ;; + esac + + read -r -p "更新完毕,是否需要重启(Y/N): " input + case $input in + [yY][eE][sS]|[yY]) + case $server_name in + "login") + ssh "$ip" "bash /usr/local/apache-tomcat-7.0.79/login_reboot.sh" + ssh "$ip" "ps -ef | grep tomcat" + echo "${server_name} ${ip} 重启完成" + ;; + "pay") + ssh "$ip" "bash /data/jieling/delivery-server/pay_reboot.sh" + ssh "$ip" "ps -ef | grep delivery" + echo "${server_name} ${ip} 重启完成" + ;; + *) + echo -e "更新服务不存在!" + exit 0 + ;; + esac + ;; + *) + echo "over..." + exit 0 + ;; + esac +} + # 主程序入口 main_menu() { while true; do @@ -170,7 +216,7 @@ main_menu() { 1) game_server_option "logic" ;; 2) game_server_option "world" ;; 3) game_server_option "chat" ;; - 4) echo -e "${red}暂未开放!!!${NC}" ;; + 4) ;; 5) echo -e "${red}暂未开放!!!${NC}" ;; 6) echo -e "${red}暂未开放!!!${NC}" ;; 0) echo -e "${red}谢谢使用,再见!${NC}" diff --git a/update_sk_login.sh b/update_sk_login.sh new file mode 100644 index 0000000..646a825 --- /dev/null +++ b/update_sk_login.sh @@ -0,0 +1,20 @@ +#!/bin/bash +. /etc/profile +######################################################################### +# File Name: build.sh +# Created on: 2019-08-15 11:56:54 +# Author: Wu Kang +# Last Modified: 2023-05-12 15:59:45 +# Description: +######################################################################### +ip=$1 +cd /data/update/project/sk_login/ || exit +git pull +./gradlew clean +./gradlew build +./gradlew jar + +if [ ! -z ${ip} ];then + scp build/libs/loginserver-1.0-SNAPSHOT.war ${ip}:/usr/local/apache-tomcat-7.0.79/webapps/sk_loginserver.war + scp login_reboot.sh ${ip}:/usr/local/apache-tomcat-7.0.79/login_reboot.sh +fi diff --git a/update_sk_pay.sh b/update_sk_pay.sh new file mode 100644 index 0000000..a73e3fc --- /dev/null +++ b/update_sk_pay.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +######################################################################### +# File Name: update-delivery.sh +# Created on: 2019-09-11 16:21:57 +# Author: Wu Kang +# Last Modified: 2022-03-02 18:23:36 +# Description: +######################################################################### + +#/bin/bash +#by wk +. /etc/profile +ip=$1 +cd /data/update/project/sk_pay || exit +git pull +mvn clean package +if [ ! -z ${ip} ];then + scp ${BASE_DIR}/target/delivery-server-1.0-SNAPSHOT.jar ${ip}:/data/shikong/delivery-server/ + scp ${BASE_DIR}/pay_reboot.sh ${ip}:/data/shikong/delivery-server/pay_reboot.sh +fi