298 lines
7.4 KiB
Bash
Executable File
298 lines
7.4 KiB
Bash
Executable File
#!/bin/sh
|
|
if [ $# != 1 ] ; then
|
|
echo "需要1个参数"
|
|
echo "stable: 同步代码到 stable 服务器上,作为正式服使用"
|
|
echo "alpha: 同步代码到 alpha 服务器上,作为测试服供服务开发使用"
|
|
echo "dev: 同步代码到 dev 服务器上,作为测试服供服务开发使用"
|
|
echo "monitor: 同步代码到 monitor 服务器上,用做监控和压力测试"
|
|
echo "distribute: 同步代码到 distribute 服务器上,用做监控和压力测试"
|
|
echo "sq1: 同步代码到 sq1 服务器上,用做 37 功能测试服 game-server 部署"
|
|
echo "zyx: 同步代码到 zyx 服务器上,用做公测自营大区 game-server 部署"
|
|
exit 1;
|
|
fi
|
|
|
|
port=22
|
|
env=${1}
|
|
|
|
if [ ${1} == 'stable' ] ; then
|
|
destUrl="root@zyz:/root/zyz/"
|
|
elif [ ${1} == 'alpha' ] ; then
|
|
destUrl="root@zyzalpha:/root/zyz/"
|
|
elif [ ${1} == 'dev' ] ; then
|
|
destUrl="root@zyzdev:/root/zyz/"
|
|
elif [ ${1} == 'isbn' ] ; then
|
|
destUrl="root@zyzisbn:/root/zyz/"
|
|
elif [ ${1} == 'isbnhk' ] ; then
|
|
destUrl="root@zyzisbnhk:/root/zyz/"
|
|
elif [ ${1} == 'monitor' ] ; then
|
|
destUrl="root@zyzmon:/root/zyz/"
|
|
elif [ ${1} == 'monitor2' ] ; then
|
|
destUrl="root@zyzmon2:/root/zyz/"
|
|
elif [ ${1} == 'distribute' ] ; then
|
|
destUrl="root@zyzdistribute:/root/zyz/"
|
|
elif [ ${1} == 'sq1' ] ; then
|
|
destUrl="root@sq1:/root/zyz/"
|
|
port=3737
|
|
elif [ ${1} == 'sq2' ] ; then
|
|
destUrl="root@sq2:/root/zyz/"
|
|
port=3737
|
|
env='sq2'
|
|
elif [ ${1} == 'sq3' ] ; then
|
|
destUrl="root@sq3:/root/zyz/"
|
|
port=3737
|
|
env='sq3'
|
|
elif [ ${1} == 'sq4' ] ; then
|
|
destUrl="root@sq4:/root/zyz/"
|
|
port=3737
|
|
env='sq7'
|
|
elif [ ${1} == 'sq5' ] ; then
|
|
destUrl="root@sq5:/root/zyz/"
|
|
port=3737
|
|
env='sq7'
|
|
elif [ ${1} == 'sq6' ] ; then
|
|
destUrl="root@sq6:/root/zyz/"
|
|
port=3737
|
|
env='sq4'
|
|
elif [ ${1} == 'sq7' ] ; then
|
|
destUrl="root@sq7:/root/zyz/"
|
|
port=3737
|
|
env='sq7'
|
|
elif [ ${1} == 'sq8' ] ; then
|
|
destUrl="root@sq8:/root/zyz/"
|
|
port=3737
|
|
env='sq7'
|
|
elif [ ${1} == 'sq9' ] ; then
|
|
destUrl="root@sq9:/root/zyz/"
|
|
port=22
|
|
env='sq9'
|
|
elif [ ${1} == 'sq10' ] ; then
|
|
destUrl="root@sq10:/root/zyz/"
|
|
port=22
|
|
env='sq9'
|
|
elif [ ${1} == 'zy1' ] ; then
|
|
destUrl="root@yjz-zy-game1:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy2' ] ; then
|
|
destUrl="root@yjz-zy-game2:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy3' ] ; then
|
|
destUrl="root@yjz-zy-game3:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy4' ] ; then
|
|
destUrl="root@yjz-zy-game4:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy5' ] ; then
|
|
destUrl="root@yjz-zy-game5:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy6' ] ; then
|
|
destUrl="root@yjz-zy-game6:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy7' ] ; then
|
|
destUrl="root@yjz-zy-game7:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy8' ] ; then
|
|
destUrl="root@yjz-zy-game8:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy9' ] ; then
|
|
destUrl="root@yjz-zy-game9:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy10' ] ; then
|
|
destUrl="root@yjz-zy-game10:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zyweb1' ] ; then
|
|
destUrl="root@yjz-zy-web1:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zyweb2' ] ; then
|
|
destUrl="root@yjz-zy-web2:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zyweb3' ] ; then
|
|
destUrl="root@yjz-zy-web3:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zyweb4' ] ; then
|
|
destUrl="root@yjz-zy-web4:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
# ch1 - ch6, chweb1 - chweb3
|
|
elif [ ${1} == 'ch1' ] ; then
|
|
destUrl="root@yjz-ch-game1:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch2' ] ; then
|
|
destUrl="root@yjz-ch-game2:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch3' ] ; then
|
|
destUrl="root@yjz-ch-game3:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch4' ] ; then
|
|
destUrl="root@yjz-ch-game4:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch5' ] ; then
|
|
destUrl="root@yjz-ch-game5:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch6' ] ; then
|
|
destUrl="root@yjz-ch-game6:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'chweb1' ] ; then
|
|
destUrl="root@yjz-ch-web1:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'chweb2' ] ; then
|
|
destUrl="root@yjz-ch-web2:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'chweb3' ] ; then
|
|
destUrl="root@yjz-ch-web3:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'zymid1' ] ; then
|
|
destUrl="root@yjz-zy-mid1:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zymid2' ] ; then
|
|
destUrl="root@yjz-zy-mid2:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zygm1' ] ; then
|
|
destUrl="root@yjz-gm-1:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zygm2' ] ; then
|
|
destUrl="root@yjz-gm-2:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'yjzios' ] ; then
|
|
destUrl="root@yjz-ios-review:/root/zyz/"
|
|
port=22
|
|
env='yjzios'
|
|
elif [ ${1} == 'zy11' ] ; then
|
|
destUrl="root@yjz-bk-1:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy12' ] ; then
|
|
destUrl="root@yjz-bk-2:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy13' ] ; then
|
|
destUrl="root@yjz-bk-3:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy14' ] ; then
|
|
destUrl="root@yjz-bk-4:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy15' ] ; then
|
|
destUrl="root@yjz-bk-5:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
elif [ ${1} == 'zy16' ] ; then
|
|
destUrl="root@yjz-bk-6:/root/zyz/"
|
|
port=22
|
|
env='zy1'
|
|
# elif [ ${1} == 'zy17' ] ; then
|
|
# destUrl="root@yjz-bk-7:/root/zyz/"
|
|
# port=22
|
|
# env='zy1'
|
|
# elif [ ${1} == 'zy18' ] ; then
|
|
# destUrl="root@yjz-bk-8:/root/zyz/"
|
|
# port=22
|
|
# env='zy1'
|
|
# elif [ ${1} == 'zy19' ] ; then
|
|
# destUrl="root@yjz-bk-9:/root/zyz/"
|
|
# port=22
|
|
# env='zy1'
|
|
elif [ ${1} == 'ch7' ] ; then
|
|
destUrl="root@yjz-bk-10:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch8' ] ; then
|
|
destUrl="root@yjz-bk-11:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
elif [ ${1} == 'ch9' ] ; then
|
|
destUrl="root@yjz-bk-12:/root/zyz/"
|
|
port=22
|
|
env='ch1'
|
|
# elif [ ${1} == 'ch10' ] ; then
|
|
# destUrl="root@yjz-bk-13:/root/zyz/"
|
|
# port=22
|
|
# env='ch1'
|
|
# elif [ ${1} == 'ch11' ] ; then
|
|
# destUrl="root@yjz-bk-14:/root/zyz/"
|
|
# port=22
|
|
# env='ch1'
|
|
# elif [ ${1} == 'ch12' ] ; then
|
|
# destUrl="root@yjz-bk-15:/root/zyz/"
|
|
# port=22
|
|
# env='ch1'
|
|
elif [ ${1} == 'zytest' ] ; then
|
|
destUrl="root@yjz-bk-1:/root/zyz/"
|
|
port=22
|
|
env='zytest'
|
|
else
|
|
echo "需要一个参数指明服务器"
|
|
exit 1;
|
|
fi
|
|
|
|
echo "|*********************|\n"
|
|
|
|
if branch=$(git symbolic-ref --short -q HEAD)
|
|
then
|
|
echo "git on branch $branch \n"
|
|
else
|
|
echo "git not on any branch \n"
|
|
fi
|
|
echo "|*********************|\n"
|
|
|
|
echo "and config.json is: \n"
|
|
node ./config.js ${env} ${1}
|
|
cat './game-server/config.json'
|
|
echo "\n"
|
|
echo "|*********************|\n"
|
|
|
|
echo "and server_const is \n"
|
|
cat './shared/resource/jsons/server_const.json' | grep DEBUG_PAY
|
|
cat './shared/resource/jsons/server_const.json' | grep DEBUG_TIME
|
|
cat './shared/resource/jsons/server_const.json' | grep CHECK_WORD
|
|
cat './shared/resource/jsons/server_const.json' | grep CAN_PAY
|
|
cat './shared/resource/jsons/server_const.json' | grep SKIP_ENCODE
|
|
echo "\n"
|
|
echo "|*********************|"
|
|
|
|
read -r -p "Are You Sure? [Y/n]" input
|
|
|
|
case $input in
|
|
[yY][eE][sS]|[yY])
|
|
echo "Yes"
|
|
rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude-from='exclude-file.txt' --progress --inplace --no-owner --no-group --rsh='ssh -p'${port} . ${destUrl}
|
|
;;
|
|
[nN][oO]|[nN])
|
|
echo "No"
|
|
;;
|
|
*)
|
|
echo "Invalid input"
|
|
;;
|
|
esac
|
|
|
|
git checkout ./game-server/config.json
|
|
git checkout ./gm-server/config/env
|
|
git checkout ./web-server/config/env
|
|
git checkout ./web-server/config/sshHost.ts
|