时空脚本优化

main
grimm 2024-07-18 15:36:43 +08:00
parent 063dd1e142
commit bb09352c96
3 changed files with 65 additions and 4 deletions

View File

@ -5,6 +5,7 @@ stty erase ^h
# 文字颜色
red='\033[31m'
# shellcheck disable=SC2034
green='\033[32m'
yellow='\033[33m'
blue='\033[34m'
@ -91,7 +92,9 @@ server_build_update(){
send_server_package $channel $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
echo "暂未开放重启功能..."
ssh "$ip" "bash $destination_dir/bin/stop.sh core1"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh core1"
;;
*)
echo "更新结束..."
@ -103,7 +106,9 @@ server_build_update(){
send_server_package $ip $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
echo "暂未开放重启功能..."
ssh "$ip" "bash $destination_dir/bin/stop.sh core1"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh core1"
;;
*)
echo "更新结束..."
@ -113,8 +118,64 @@ server_build_update(){
fi
;;
"world")
if if_ip "$channel"; then
send_server_package $channel $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
ssh "$ip" "bash $destination_dir/bin/stop.sh world"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh world"
;;
*)
echo "更新结束..."
;;
esac
else
for ip in $(awk '{print $2}' "txt/$channel")
do
send_server_package $ip $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
ssh "$ip" "bash $destination_dir/bin/stop.sh world"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh world"
;;
*)
echo "更新结束..."
;;
esac
done
fi
;;
"chat")
if if_ip "$channel"; then
send_server_package $channel $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
ssh "$ip" "bash $destination_dir/bin/stop.sh chat"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh chat"
;;
*)
echo "更新结束..."
;;
esac
else
for ip in $(awk '{print $2}' "txt/$channel")
do
send_server_package $ip $package $source_tar $destination_dir
case $reboot in
[yY][eE][sS]|[yY])
ssh "$ip" "bash $destination_dir/bin/stop.sh chat"
sleep 5
ssh "$ip" "bash $destination_dir/bin/start.sh chat"
;;
*)
echo "更新结束..."
;;
esac
done
fi
;;
esac
}

View File

@ -16,6 +16,6 @@ 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}/target/idip-1.0-SNAPSHOT.jar ${ip}:/data/shikong/idip/
scp ${BASE_DIR}/pay_reboot.sh ${ip}:/data/shikong/delivery-server/pay_reboot.sh
fi

View File

@ -10,7 +10,7 @@
branch=$1
package=$2
packages=${package}_logic.tar.gz
packages=${package}_server.tar.gz
if [ ! $branch ];then
echo "branch is not exiting,"
exit 7