main
PC-202302260912\Administrator 2023-07-25 16:04:18 +08:00
parent 7c0155a0ac
commit 992b641625
1 changed files with 67 additions and 57 deletions

124
main.sh
View File

@ -4,21 +4,31 @@
stty erase ^h
# 定义ANSI颜色转义码
RED='\033[0;31m' #红色
GREEN='\033[0;32m' #绿色
YELLOW='\033[0;33m' #黄色
#red='\033[0;31m' #红色
#green='\033[0;32m' #绿色
#yello='\033[0;33m' #黄色
#NC='\033[0m'
#文字颜色:
red='\033[31m'
green='\033[32m'
yello='\033[33m'
blue='\033[34m'
purple='\033[35m'
cyan='\033[36m'
white='\033[37m'
NC='\033[0m' # 恢复默认颜色
# 定义函数,用于展示菜单选项
show_menu() {
echo -e "================================"
echo -e "欢迎使用${GREEN}戒灵更新脚本${NC}"
echo -e "1. ${YELLOW}游戏服更新${NC}"
echo -e "2. ${YELLOW}gm更新${NC}"
echo -e "3. ${YELLOW}登陆服更新${NC}"
echo -e "4. ${YELLOW}支付服更新${NC}"
echo -e "5. ${YELLOW}敏感词服更新${NC}"
echo -e "0. ${RED}退出${NC}"
echo -e "欢迎使用${green}戒灵更新脚本${NC}"
echo -e "1. ${yello}游戏服更新${NC}"
echo -e "2. ${yello}gm更新${NC}"
echo -e "3. ${yello}登陆服更新${NC}"
echo -e "4. ${yello}支付服更新${NC}"
echo -e "5. ${yello}敏感词服更新${NC}"
echo -e "0. ${red}退出${NC}"
}
show_file(){
@ -35,31 +45,31 @@ handle_input() {
game
;;
2)
echo -e "${YELLOW}开始更新gm服${NC}"
echo -e "${yello}开始更新gm服${NC}"
# 在这里编写选项二的代码
gm
;;
3)
echo -e "${YELLOW}开始更新登陆服${NC}"
echo -e "${yello}开始更新登陆服${NC}"
# 在这里编写选项三的代码
login
;;
4)
echo -e "${YELLOW}开始更新支付服${NC}"
echo -e "${yello}开始更新支付服${NC}"
# 在这里编写选项四的代码
pay
;;
5)
echo -e "${YELLOW}开始更新敏感词服${NC}"
echo -e "${yello}开始更新敏感词服${NC}"
# 在这里编写选项五的代码
mingan
;;
0)
echo -e "${RED}谢谢使用,再见!${NC}"
echo -e "${red}谢谢使用,再见!${NC}"
exit 0
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
handle_input
;;
esac
@ -105,17 +115,17 @@ send_many_ip(){
#游戏服更新
game(){
echo -e "================================"
echo -e "开始更新${GREEN}游戏服${NC}"
echo -e "1. ${YELLOW}打包${NC}"
echo -e "2. ${YELLOW}单服更新发送${NC}"
echo -e "3. ${YELLOW}渠道更新发送${NC}"
echo -e "4. ${YELLOW}单服更新并重启${NC}"
echo -e "5. ${YELLOW}渠道更新并重启${NC}"
echo -e "0. ${GREEN}返回主菜单${NC}"
echo -e "开始更新${green}游戏服${NC}"
echo -e "1. ${yello}打包${NC}"
echo -e "2. ${yello}单服更新发送${NC}"
echo -e "3. ${yello}渠道更新发送${NC}"
echo -e "4. ${yello}单服更新并重启${NC}"
echo -e "5. ${yello}渠道更新并重启${NC}"
echo -e "0. ${green}返回主菜单${NC}"
read -p "请输入选项编号: " choice
case $choice in
1)
echo -e "${YELLOW}打包${NC}"
echo -e "${yello}打包${NC}"
show_file project
read -p "请输入项目地址: " project
show_file package
@ -125,7 +135,7 @@ game(){
game
;;
2)
echo -e "${YELLOW}单独发送${NC}"
echo -e "${yello}单独发送${NC}"
show_file package
read -p "请输入包名(不需要带文件后缀): " package
read -p "请输入游戏服ip: " ip
@ -134,7 +144,7 @@ game(){
game
;;
3)
echo -e "${YELLOW}渠道发送${NC}"
echo -e "${yello}渠道发送${NC}"
show_file package
read -p "请输入包名(不需要带文件后缀): " package
show_file script/txt
@ -144,7 +154,7 @@ game(){
game
;;
4)
echo -e "${YELLOW}单独发送并重启${NC}"
echo -e "${yello}单独发送并重启${NC}"
show_file package
read -p "请输入包名(不需要带文件后缀): " package
read -p "请输入游戏服ip: " ip
@ -154,7 +164,7 @@ game(){
game
;;
5)
echo -e "${YELLOW}渠道发送并重启${NC}"
echo -e "${yello}渠道发送并重启${NC}"
show_file package
read -p "请输入包名(不需要带文件后缀): " package
show_file script/txt
@ -168,7 +178,7 @@ game(){
handle_input
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
game
;;
esac
@ -177,14 +187,14 @@ game(){
#gm更新
gm(){
echo -e "================================"
echo -e "开始更新${GREEN}gm服${NC}"
echo -e "1. ${YELLOW}单渠道更新${NC}"
echo -e "2. ${YELLOW}多渠道更新${NC}"
echo -e "0. ${GREEN}返回主菜单${NC}"
echo -e "开始更新${green}gm服${NC}"
echo -e "1. ${yello}单渠道更新${NC}"
echo -e "2. ${yello}多渠道更新${NC}"
echo -e "0. ${green}返回主菜单${NC}"
read -p "请输入选项编号: " choice
case $choice in
1)
echo -e "${YELLOW}单渠道更新${NC}"
echo -e "${yello}单渠道更新${NC}"
show_file project
read -p "请输入表所在游戏项目地址: " project
read -p "请输入gm服ip: " ip
@ -193,7 +203,7 @@ gm(){
gm
;;
2)
echo -e "${YELLOW}多渠道更新${NC}"
echo -e "${yello}多渠道更新${NC}"
show_file project
read -p "请输入项目地址: " project
@ -206,7 +216,7 @@ gm(){
handle_input
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
gm
;;
esac
@ -215,21 +225,21 @@ gm(){
#登陆 ssh $i "sh /data/jieling/gm/gm_restart.sh"
login(){
echo -e "================================"
echo -e "开始更新${GREEN}登陆服${NC}"
echo -e "1. ${YELLOW}更新登陆服代码${NC}"
echo -e "2. ${YELLOW}重启登陆服${NC}"
echo -e "0. ${GREEN}返回主菜单${NC}"
echo -e "开始更新${green}登陆服${NC}"
echo -e "1. ${yello}更新登陆服代码${NC}"
echo -e "2. ${yello}重启登陆服${NC}"
echo -e "0. ${green}返回主菜单${NC}"
read -p "请输入选项编号: " choice
case $choice in
1)
echo -e "${YELLOW}登陆服更新${NC}"
echo -e "${yello}登陆服更新${NC}"
read -p "请输入登陆服ip: " ip
echo -e "开始更新登陆服 ip$ip"
bash update_login.sh $ip
login
;;
2)
echo -e "${YELLOW}登陆服重启${NC}"
echo -e "${yello}登陆服重启${NC}"
read -p "请输入登陆服ip: " ip
echo -e "开始重启登陆服 ip$ip"
ssh $ip "bash /usr/local/apache-tomcat-7.0.79/bin/shutdown.sh"
@ -243,7 +253,7 @@ login(){
handle_input
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
login
;;
esac
@ -252,21 +262,21 @@ login(){
#支付
pay(){
echo -e "================================"
echo -e "开始更新${GREEN}支付服${NC}"
echo -e "1. ${YELLOW}更新支付服代码${NC}"
echo -e "2. ${YELLOW}重启支付服${NC}"
echo -e "0. ${GREEN}返回主菜单${NC}"
echo -e "开始更新${green}支付服${NC}"
echo -e "1. ${yello}更新支付服代码${NC}"
echo -e "2. ${yello}重启支付服${NC}"
echo -e "0. ${green}返回主菜单${NC}"
read -p "请输入选项编号: " choice
case $choice in
1)
echo -e "${YELLOW}支付服更新${NC}"
echo -e "${yello}支付服更新${NC}"
read -p "请输入支付服ip: " ip
echo -e "开始更新支付服 ip$ip"
bash update_delivery.sh $ip
pay
;;
2)
echo -e "${YELLOW}支付服重启${NC}"
echo -e "${yello}支付服重启${NC}"
read -p "请输入支付服ip: " ip
echo -e "开始重启支付服 ip$ip"
ssh $ip "bash /data/jieling/delivery-server/pay_restart.sh"
@ -278,7 +288,7 @@ pay(){
handle_input
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
pay
;;
esac
@ -287,21 +297,21 @@ pay(){
#敏感词
mingan(){
echo -e "================================"
echo -e "开始更新${GREEN}敏感词服${NC}"
echo -e "1. ${YELLOW}更新敏感词服代码${NC}"
echo -e "2. ${YELLOW}重启敏感词服${NC}"
echo -e "0. ${GREEN}返回主菜单${NC}"
echo -e "开始更新${green}敏感词服${NC}"
echo -e "1. ${yello}更新敏感词服代码${NC}"
echo -e "2. ${yello}重启敏感词服${NC}"
echo -e "0. ${green}返回主菜单${NC}"
read -p "请输入选项编号: " choice
case $choice in
1)
echo -e "${YELLOW}敏感词服更新${NC}"
echo -e "${yello}敏感词服更新${NC}"
read -p "请输入敏感词服ip: " ip
echo -e "开始更新敏感词服 ip$ip"
bash update_sensitive.sh $ip
mingan
;;
2)
echo -e "${YELLOW}敏感词服重启${NC}"
echo -e "${yello}敏感词服重启${NC}"
read -p "请输入敏感词服ip: " ip
echo -e "开始重启敏感词服 ip$ip"
ssh $ip "bash /data/jieling/sensitiveWordFilter/bin/mingan_reboot.sh"
@ -313,7 +323,7 @@ mingan(){
handle_input
;;
*)
echo -e "${RED}无效的选项,请重新输入${NC}"
echo -e "${red}无效的选项,请重新输入${NC}"
mingan
;;
esac