main
parent
d3a9ac97f7
commit
90966634c3
85
main.sh
85
main.sh
|
@ -18,14 +18,9 @@ show_menu() {
|
|||
echo -e "0. ${RED}退出${NC}"
|
||||
}
|
||||
|
||||
show_folder(){
|
||||
filer=$1
|
||||
ls -l /data/update/$filer/ |awk '/^d/ {print $NF}'
|
||||
}
|
||||
|
||||
show_file(){
|
||||
filer=$1
|
||||
ls -l /data/update/$filer/ |awk '{print $NF}'
|
||||
ls /data/update/$filer/ | tr ' ' '\n'
|
||||
}
|
||||
|
||||
# 定义函数,用于处理用户输入
|
||||
|
@ -67,6 +62,43 @@ handle_input() {
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
# 源服务器上的tar压缩包路径
|
||||
source_tar="/data/update/package/"
|
||||
# 目标服务器上的目标目录路径
|
||||
destination_dir="/data/"
|
||||
#单服发送
|
||||
send_one_ip(){
|
||||
package=${1}.tar.gz
|
||||
ip=${2}
|
||||
# 单服务器更新
|
||||
echo "正在处理服务器 $ip "
|
||||
scp "$source_tar/$package" "$ip:$destination_dir"
|
||||
ssh "$ip" "tar -zxvf $destination_dir/$package -C $destination_dir/jieling/server/"
|
||||
ssh "$ip" "rm -rf $destination_dir/$package"
|
||||
echo "处理完成服务器 $ip "
|
||||
}
|
||||
|
||||
#多服发送
|
||||
send_many_ip(){
|
||||
package=${1}.tar.gz
|
||||
iptxt=${2}.txt
|
||||
reboot=$3
|
||||
for i in `awk '{print $2}' /data/update/script/txt/$iptxt`
|
||||
do
|
||||
echo "正在处理服务器 $i "
|
||||
scp "$source_tar/$package" "$i:$destination_dir"
|
||||
ssh "$i" "tar -zxvf $destination_dir/$package -C $destination_dir/jieling/server/"
|
||||
ssh "$i" "rm -rf $destination_dir/$package"
|
||||
echo "处理完成服务器 $i "
|
||||
|
||||
if [ ! -z $reboot ];then
|
||||
ssh "$i" "supervisorctl restart all"
|
||||
echo "重启服务器 $i "
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#游戏服更新
|
||||
game(){
|
||||
echo -e "================================"
|
||||
|
@ -81,7 +113,7 @@ game(){
|
|||
case $choice in
|
||||
1)
|
||||
echo -e "${YELLOW}打包${NC}"
|
||||
show_folder project
|
||||
show_file project
|
||||
stty erase ^h
|
||||
read -p "请输入项目地址: " project
|
||||
show_file package
|
||||
|
@ -149,41 +181,6 @@ game(){
|
|||
esac
|
||||
}
|
||||
|
||||
# 源服务器上的tar压缩包路径
|
||||
source_tar="/data/update/package/"
|
||||
# 目标服务器上的目标目录路径
|
||||
destination_dir="/data/"
|
||||
#单服发送
|
||||
send_one_ip(){
|
||||
package=${1}.tar.gz
|
||||
ip=${2}
|
||||
# 单服务器更新
|
||||
echo "正在处理服务器 $ip "
|
||||
scp "$source_tar/$package" "$ip:$destination_dir"
|
||||
ssh "$ip" "tar -zxvf $destination_dir/$package -C $destination_dir/jieling/server/"
|
||||
ssh "$ip" "rm -rf $destination_dir/$package"
|
||||
echo "处理完成服务器 $ip "
|
||||
}
|
||||
#多服发送
|
||||
send_many_ip(){
|
||||
package=${1}.tar.gz
|
||||
iptxt=${2}.txt
|
||||
reboot=$3
|
||||
for i in `awk '{print $2}' /data/update/script/txt/$iptxt`
|
||||
do
|
||||
echo "正在处理服务器 $i "
|
||||
scp "$source_tar/$package" "$i:$destination_dir"
|
||||
ssh "$i" "tar -zxvf $destination_dir/$package -C $destination_dir/jieling/server/"
|
||||
ssh "$i" "rm -rf $destination_dir/$package"
|
||||
echo "处理完成服务器 $i "
|
||||
|
||||
if [ ! -z $reboot ];then
|
||||
ssh "$i" "supervisorctl restart all"
|
||||
echo "重启服务器 $i "
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#gm更新
|
||||
gm(){
|
||||
echo -e "================================"
|
||||
|
@ -195,7 +192,7 @@ gm(){
|
|||
case $choice in
|
||||
1)
|
||||
echo -e "${YELLOW}单渠道更新${NC}"
|
||||
show_folder project
|
||||
show_file project
|
||||
stty erase ^h
|
||||
read -p "请输入表所在游戏项目地址: " project
|
||||
stty erase ^h
|
||||
|
@ -206,7 +203,7 @@ gm(){
|
|||
;;
|
||||
2)
|
||||
echo -e "${YELLOW}多渠道更新${NC}"
|
||||
show_folder project
|
||||
show_file project
|
||||
stty erase ^h
|
||||
read -p "请输入项目地址: " project
|
||||
echo -e "开始更新gm"
|
||||
|
|
Loading…
Reference in New Issue