This commit is contained in:
aozhiwei 2019-12-16 19:56:14 +08:00
parent 9fb79fdefb
commit a27bd57c6e
4 changed files with 54 additions and 53 deletions

1
server/bin/monitor.sh Normal file
View File

@ -0,0 +1 @@
python ../../third_party/tools/scripts/server/monitor.py gameserver2001 '-n1 -i1'

View File

@ -1,30 +0,0 @@
# -*- 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()

View File

@ -3,10 +3,15 @@ cmake_minimum_required(VERSION 2.8)
set(GAME_ID 2002)
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}")
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")
include_directories(
AFTER
@ -19,6 +24,7 @@ include_directories(
../../third_party
../../third_party/behaviac/inc
../../third_party/recastnavigation/Detour/Include
../../third_party/recastnavigation/DetourTileCache/Include
.
)
@ -40,6 +46,9 @@ 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
@ -62,7 +71,7 @@ set(EXECUTABLE_OUTPUT_PATH
)
add_executable(
gameserver ${SRC_LIST}
gameserver${GAME_ID} ${SRC_LIST}
)
add_custom_target(script_pb_protocol ALL)
@ -70,21 +79,42 @@ 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 script_pb_protocol)
add_dependencies(gameserver${GAME_ID} script_pb_protocol)
target_link_libraries(
gameserver
pthread
mysqlclient
protobuf
rt
dl
util
crypto
ssl
jsoncpp
curl
hiredis
tinyxml2
behaviac_gcc_release
)
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()

@ -1 +1 @@
Subproject commit b9f2f205afe3226fa06b6a3b9e62fcd6eaca63b8
Subproject commit 240414570ee2848291d24ff8d3102dc43d4104a3