代码拉取完成,页面将自动刷新
#!/bin/bash
source ./env
# =============================================================================
cd $(dirname $0)
# =============================================================================
_usage() {
echo "$0 command [args...]"
echo "commands:"
echo " <start|stop|update|status> <svr|exes|webs|all> controls servers"
echo " debug <game-name> [stop] remote debugging"
echo " gen <config> generate config.json"
exit 1
}
[ ! $2 ] && _usage
ADMIN="./jumper/dev/deploy/admin.sh"
CORE_DEPLOY="./jumper/dev/deploy/scripts/core/printconf.js"
HOST=$($CORE_DEPLOY -h game1)
DEBUG_PORT=${debug_port}
WEBS=$($CORE_DEPLOY -n webs)" "$($CORE_DEPLOY -n bats)
EXES=$($CORE_DEPLOY -n routers)" "$($CORE_DEPLOY -n games)" "$($CORE_DEPLOY -n gates)
case "$2" in
all)
./dev.sh $1 webs
./dev.sh $1 exes
;;
webs)
echo $WEBS | xargs -P 25 -n 1 ./dev.sh $1
;;
exes)
echo $EXES | xargs -P 25 -n 1 ./dev.sh $1
;;
*)
case "$1" in
gen)
if [ "$2" == "config" ]; then
$CORE_DEPLOY -c > svrgo/internal/config/config.json
fi
exit 0
;;
start)
ssh game@$HOST "
[ -x $WORK_DIR/$2/dev_pre_start.sh ] && $WORK_DIR/$2/dev_pre_start.sh
"
$ADMIN start $2
;;
stop)
$ADMIN stop $2
;;
update)
$ADMIN stop $2
$ADMIN update $2
ssh game@$HOST "
[ -x $WORK_DIR/$2/dev_pre_start.sh ] && $WORK_DIR/$2/dev_pre_start.sh
"
$ADMIN start $2
;;
status)
$ADMIN status $2
;;
debug)
if [ "$3" == "stop" ]; then
ssh game@$HOST "
kill \$(ps ux | grep $2 | grep -v dlv | grep -v grep | awk '{print \$2}')
"
else
[ ! $DEBUG_PORT ] && echo "please specify debug_port in your env.local" && exit 1
./build.sh -d game
cd bin
tar -hczf debug_game.tar.gz game gamedata config.json
ssh game@$HOST "
mkdir -p $WORK_DIR/_$LOGNAME
rm -rf $WORK_DIR/_$LOGNAME/\*
"
scp debug_game.tar.gz game@$HOST:$WORK_DIR/_$LOGNAME
rm debug_game.tar.gz
ssh game@$HOST "
cd $WORK_DIR/$2
./ctl.sh stop
cd $WORK_DIR/_$LOGNAME
tar -xf debug_game.tar.gz
rm debug_game.tar.gz
echo '===== debugging $2 ====='
dlv exec --headless --listen $HOST:$DEBUG_PORT --api-version 2 -- ./game -config config.json -server $2
"
fi
exit 0
;;
esac
# post script of the remote host
ssh game@$HOST "
[ -x $WORK_DIR/$2/dev_post.sh ] && $WORK_DIR/$2/dev_post.sh $@
"
esac
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。