Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
02617d5aba |
@ -1,11 +0,0 @@
|
||||
path_arr=$(echo $PWD|tr '/' '\n')
|
||||
path_arr=(${path_arr})
|
||||
GAME_ID=${path_arr[-5]}
|
||||
|
||||
if echo $GAME_ID | grep -q '[^0-9]'
|
||||
then
|
||||
echo 'game_id参数必须为数字'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python ../../third_party/tools/scripts/server/monitor.py gameserver${GAME_ID} '-n1 -i1'
|
30
server/bin/monitor_game2002.py
Normal file
30
server/bin/monitor_game2002.py
Normal file
@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import time
|
||||
|
||||
def getRuningProgramPids(progname):
|
||||
pids = []
|
||||
lines = os.popen('ps -ef | grep %s' % progname).readlines()
|
||||
for l in lines:
|
||||
line = ''
|
||||
oldc = ''
|
||||
for c in l.strip():
|
||||
if c in [' ', '\t'] and c == oldc:
|
||||
continue
|
||||
oldc = c
|
||||
line += c
|
||||
line = line.split(' ')
|
||||
|
||||
if line[7] == './%s' % progname:
|
||||
pids.append(line[1])
|
||||
return pids
|
||||
|
||||
def monitor_gs():
|
||||
while True:
|
||||
pids = getRuningProgramPids('gameserver2002')
|
||||
if len(pids) <= 0:
|
||||
print('zzzz')
|
||||
os.popen('nohup ./gameserver2002 -n1 -i1 -f1,2,4>> gameserver2002.out 2>&1 &')
|
||||
time.sleep(2)
|
||||
|
||||
monitor_gs()
|
@ -3,15 +3,10 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(GAME_ID 2002)
|
||||
|
||||
if (${RELEASE})
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
message("release mode")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
message("debug mode")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG")
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
#set(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
||||
|
||||
include_directories(
|
||||
AFTER
|
||||
@ -24,7 +19,6 @@ include_directories(
|
||||
../../third_party
|
||||
../../third_party/behaviac/inc
|
||||
../../third_party/recastnavigation/Detour/Include
|
||||
../../third_party/recastnavigation/DetourTileCache/Include
|
||||
.
|
||||
)
|
||||
|
||||
@ -46,9 +40,6 @@ aux_source_directory(../../third_party/recastnavigation/Detour/Source
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
aux_source_directory(../../third_party/recastnavigation/DetourTileCache/Source
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND touch -a cs_proto.pb.h
|
||||
@ -71,7 +62,7 @@ set(EXECUTABLE_OUTPUT_PATH
|
||||
)
|
||||
|
||||
add_executable(
|
||||
gameserver${GAME_ID} ${SRC_LIST}
|
||||
gameserver ${SRC_LIST}
|
||||
)
|
||||
|
||||
add_custom_target(script_pb_protocol ALL)
|
||||
@ -79,42 +70,21 @@ add_custom_command(TARGET script_pb_protocol
|
||||
PRE_BUILD
|
||||
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=cs_proto,cs_msgid,ss_proto,ss_msgid,metatable --python_out=../tools/robot/virtualclient
|
||||
)
|
||||
add_dependencies(gameserver${GAME_ID} script_pb_protocol)
|
||||
add_dependencies(gameserver script_pb_protocol)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_link_libraries(
|
||||
gameserver${GAME_ID}
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
rt
|
||||
dl
|
||||
util
|
||||
crypto
|
||||
ssl
|
||||
jsoncpp
|
||||
curl
|
||||
hiredis
|
||||
tinyxml2
|
||||
tcmalloc
|
||||
behaviac_gcc_debug
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
gameserver${GAME_ID}
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
rt
|
||||
dl
|
||||
util
|
||||
crypto
|
||||
ssl
|
||||
jsoncpp
|
||||
curl
|
||||
hiredis
|
||||
tinyxml2
|
||||
tcmalloc
|
||||
behaviac_gcc_release
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(
|
||||
gameserver
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
rt
|
||||
dl
|
||||
util
|
||||
crypto
|
||||
ssl
|
||||
jsoncpp
|
||||
curl
|
||||
hiredis
|
||||
tinyxml2
|
||||
behaviac_gcc_release
|
||||
)
|
||||
|
@ -81,7 +81,6 @@ void HandlerMgr::UnInit()
|
||||
void HandlerMgr::RegisterNetMsgHandlers()
|
||||
{
|
||||
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &PlayerMgr::_SS_Ping);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &RoomMgr::_CMJoin);
|
||||
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMMove);
|
||||
|
@ -7,22 +7,13 @@
|
||||
|
||||
void JsonDataMgr::Init()
|
||||
{
|
||||
if (!f8::IsOnlineEnv()) {
|
||||
if (f8::IsTestEnv()) {
|
||||
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID
|
||||
});
|
||||
} else {
|
||||
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID
|
||||
});
|
||||
}
|
||||
if (!f8::IsOnlineEnv() && App::Instance()->HasFlag(2)) {
|
||||
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID
|
||||
});
|
||||
}
|
||||
std::string gameserver_cluster_json_file;
|
||||
gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json",
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "playermgr.h"
|
||||
#include "player.h"
|
||||
#include "cs_proto.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
#include "room.h"
|
||||
#include "metamgr.h"
|
||||
|
||||
@ -26,12 +25,6 @@ void PlayerMgr::_SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_Socke
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
||||
{
|
||||
ss::SS_Pong respmsg;
|
||||
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, respmsg);
|
||||
}
|
||||
|
||||
int PlayerMgr::OnlineNum()
|
||||
{
|
||||
return socket_hash_.size();
|
||||
|
@ -8,7 +8,6 @@ namespace cs
|
||||
namespace ss
|
||||
{
|
||||
class SS_WSP_SocketDisconnect;
|
||||
class SS_Ping;
|
||||
}
|
||||
|
||||
class Player;
|
||||
@ -26,7 +25,6 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
||||
void UnInit();
|
||||
|
||||
void _SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
||||
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
|
||||
|
||||
int OnlineNum();
|
||||
Player* GetPlayerBySocket(int socket);
|
||||
|
2
third_party/a8engine
vendored
2
third_party/a8engine
vendored
@ -1 +1 @@
|
||||
Subproject commit cdb87a3e673aee3401b3e2ffce3ea1a1e6a603b0
|
||||
Subproject commit 9a8d93e085ee2ce420010501c2a1397aece62269
|
2
third_party/behaviac
vendored
2
third_party/behaviac
vendored
@ -1 +1 @@
|
||||
Subproject commit 240414570ee2848291d24ff8d3102dc43d4104a3
|
||||
Subproject commit b9f2f205afe3226fa06b6a3b9e62fcd6eaca63b8
|
2
third_party/framework
vendored
2
third_party/framework
vendored
@ -1 +1 @@
|
||||
Subproject commit eb455bb95f97dc506566c443be0c72960ceebabf
|
||||
Subproject commit 9bc053e936b590f38621a6ef7b77155558c9a415
|
2
third_party/tools
vendored
2
third_party/tools
vendored
@ -1 +1 @@
|
||||
Subproject commit b44f1b9c11a0bdf2711a8764343b37b5acb111cb
|
||||
Subproject commit 093cc5830086f8a5a69e8792f8d0f16af496233c
|
Loading…
x
Reference in New Issue
Block a user