65 lines
1.9 KiB
Bash

#!/usr/bin/env bash
#update
echo "update server"
cd ../rocommon
git checkout -- *
git pull
cd ../roserver
git checkout -- *
git pull
robotPath=/root/rorobot
runZone=3
rundbindex=4
echo "build server"
echo "[db]"
go build -o run/db -gcflags '-N -l' ./db
echo "[game]"
go build -o run/game -gcflags '-N -l' ./game
echo "[gate]"
go build -o run/gate -gcflags '-N -l' ./gate
echo "[auth]"
go build -o run/auth -gcflags '-N -l' ./auth
echo "[social]"
go build -o run/social -gcflags '-N -l' ./social
echo "[server_aoi]"
go build -o run/server_aoi -gcflags '-N -l' ./server_aoi
echo "[server_map_router]"
go build -o run/server_map_router -gcflags '-N -l' ./server_map_router
echo "[battleboss]"
go build -o run/battleboss -gcflags '-N -l' ./battleboss
echo "[rank]"
go build -o run/rank -gcflags '-N -l' ./rank
#elf files
cp -fr ./run/* $robotPath
#config files
cp -fr ./config/csv $robotPath/config
cp -fr ./config/xml $robotPath/config
#start stop shell script
cp -fr ./start.sh $robotPath
cp -fr ./stop.sh $robotPath
#set start zone id
cd $robotPath
sed -i "s/\zone: [0-9]*\S*/zone: ${runZone}/" *.yaml
sed -i "s/etcdaddr: [0-9]*\S*/etcdaddr: 127.0.0.1:2379/" *.yaml
sed -i "/dbindex:/,+d" *.yaml
sed -i "s/redisaddr: [0-9]*\S*/redisaddr: [127.0.0.1:6379]\n dbindex: ${rundbindex}/" *.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:61001/" aoi_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:6401/" auth_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:6201/" game_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:61301/" battleboss_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:6301/" db_config.yaml
sed -i "s/addr: 0.0.0.0:5101\S*/addr: 0.0.0.0:6101/" gate_config.yaml
sed -i "s/addr: 0.0.0.0:21001\S*/addr: 0.0.0.0:22002/" gate_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:6601/" rank_config.yaml
sed -i "s/addr: 0.0.0.0\S*/addr: 0.0.0.0:6501/" social_config.yaml