From 9fad4f67b34298ee6d9655f8be1cd58d62da574f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 28 Oct 2020 13:06:03 +0800 Subject: [PATCH] 1 --- server/bin/monitor.sh | 11 +++++++++++ server/bin/real_start_instance.sh | 10 ++++++++++ server/bin/restart.sh | 16 ++++++++++++++++ server/bin/start_instance.sh | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 server/bin/monitor.sh create mode 100755 server/bin/real_start_instance.sh create mode 100755 server/bin/restart.sh create mode 100755 server/bin/start_instance.sh diff --git a/server/bin/monitor.sh b/server/bin/monitor.sh new file mode 100644 index 0000000..5aa992a --- /dev/null +++ b/server/bin/monitor.sh @@ -0,0 +1,11 @@ +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' diff --git a/server/bin/real_start_instance.sh b/server/bin/real_start_instance.sh new file mode 100755 index 0000000..68b0ba4 --- /dev/null +++ b/server/bin/real_start_instance.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +source /etc/profile +source /root/.bash_profile + +./gameserver2005 -n $1 -i $2 >> gameserver2005$2_$1.out +echo $? >> start.log +date >> start.log +echo $1 $2 >> start.log +free -m >> start.log diff --git a/server/bin/restart.sh b/server/bin/restart.sh new file mode 100755 index 0000000..26a4d02 --- /dev/null +++ b/server/bin/restart.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +source /etc/profile +source /root/.bash_profile + +pid=$(ps -ef|grep "gameserver2005 -n $2 -i $1"|grep -v grep|awk '{print $2}') +echo $pid + +if [[ $pid != "" ]] +then + echo $pid|xargs kill -9 +else + echo "pid 为空" +fi + +nohup ./gameserver2005 -n $2 -i $1 >> gameserver2005$2_$1.out & diff --git a/server/bin/start_instance.sh b/server/bin/start_instance.sh new file mode 100755 index 0000000..fd2f031 --- /dev/null +++ b/server/bin/start_instance.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +nohup sh real_start_instance.sh 1 1 2>&1 &