84 lines
2.5 KiB
Bash

#!/usr/bin/env bash
#update
echo "update server"
cd ../rocommon
git checkout -- *
git pull
cd ../roserver
git checkout -- *
git pull
runPath=/root/roserverrun
runZone=2
runRemoteZone=1000
remotePath=/root/roserverremote
echo "build server"
echo "[db]"
go build -race -o run/db -gcflags '-N -l' ./db
echo "[game]"
go build -race -o run/game -gcflags '-N -l' ./game
echo "[gate]"
go build -race -o run/gate -gcflags '-N -l' ./gate
echo "[auth]"
go build -race -o run/auth -gcflags '-N -l' ./auth
echo "[social]"
go build -race -o run/social -gcflags '-N -l' ./social
#echo "[server_aoi]"
#go build -race -o run/server_aoi -gcflags '-N -l' ./server_aoi
#echo "[server_map_router]"
#go build -race -o run/server_map_router -gcflags '-N -l' ./server_map_router
echo "[battleboss]"
go build -race -o run/battleboss -gcflags '-N -l' ./battleboss
echo "[rank]"
go build -race -o run/rank -gcflags '-N -l' ./rank
echo "[guild]"
go build -race -o run/guild -gcflags '-N -l' ./guild
echo "[gmweb]"
go build -race -o run/gmweb -gcflags '-N -l' ./gmweb
echo "[battlerecord]"
go build -race -o run/battlerecord -gcflags '-N -l' ./battlerecord
echo "[crossrouter]"
go build -race -o run/crossrouter -gcflags '-N -l' ./cross_router
echo "[crossserver]"
go build -race -o run/crossserver -gcflags '-N -l' ./cross_server
echo "[crossrank]"
go build -race -o run/crossrank -gcflags '-N -l' ./cross_rank
echo "[gcrossrouter]"
go build -race -o run/gcrossrouter -gcflags '-N -l' ./globalcross_router
echo "[gcrossmap]"
go build -race -o run/gcrossmap -gcflags '-N -l' ./globalcross_map
#elf files
cp -fr ./run/* $runPath
cp -fr ./run/* $remotePath
#config files
cp -fr ./config/csv $runPath/config
cp -fr ./config/csv $remotePath/config
cp -fr ./config/xml $runPath/config
cp -fr ./config/xml $remotePath/config
#start stop shell script
cp -fr ./start.sh $runPath
cp -fr ./start.sh $remotePath
#set start zone id
cd $runPath
sed -i "s/\zone: [0-9]*\S*/zone: ${runZone}/" *.yaml
sed -i "/dbindex:/,+d" *.yaml
cd $remotePath
sed -i "s/\zone: [0-9]*\S*/zone: ${runRemoteZone}/" *.yaml
sed -i "s/etcdaddr: [0-9]*\S*/etcdaddr: 127.0.0.1:2379/" *.yaml
sed -i "s/redisaddr: [0-9]*\S*/redisaddr: [127.0.0.1:6379]/" *.yaml
sed -i "s/reconnect: 0\S*/reconnect: 1/" *.yaml
#sed -i "s/authmode: 1/authmode: 2/g" *.yaml
#sed -i "s/192.168.10.158:3306/172.17.0.1:3306/g" *.yaml
#测试服务器
sed -i "s/192.168.10.158:3306/123.57.16.238:3306/g" *.yaml
sed -i "s/127.0.0.1:9200/172.17.0.1:9200/g" *.yaml
sed -i "/dbindex:/,+d" *.yaml