From db8853f23ea8c3a189874bf42a9a56a47f87d241 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Sun, 11 Oct 2020 18:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/checkPort | 40 ++++++++++++++++++++++++++++++++++------ shell/riskenv | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/shell/checkPort b/shell/checkPort index 39c2249..82bfe73 100644 --- a/shell/checkPort +++ b/shell/checkPort @@ -2,9 +2,37 @@ # 检查客户端和服务端端口是否存在 #存在返回0否则返回1 source /app/riskenv -if [[ ! -z "`/app/findPortPid $PORT`" && ! -z "`/app/findPortPid $serverPort`" ]] -then - echo 0 -else - echo 1 -fi \ No newline at end of file + +log=/var/log/checkPort.log +function foo() { + echo $1>>$log +} + +function test(){ + check=0 + foo "=====================start check=====================" + if [ -z "`/app/findPortPid $PORT`" ] + then + foo "server status:stop" + check=1 + else + foo "server status:start" + fi + if [ -z "`/app/findPortPid $clientPort`" ] + then + foo "client status:stop" + check=1 + else + foo "server status:start" + fi + if [ $check -eq 0 ] + then + foo "server and client is running" + return 0 + else + return 1 + fi +} + +test +echo $? \ No newline at end of file diff --git a/shell/riskenv b/shell/riskenv index 28b7799..14444f1 100644 --- a/shell/riskenv +++ b/shell/riskenv @@ -6,7 +6,7 @@ export PORT=2233 #客户端访问地址 export webClient=https://risk.kirito.cool #客户端端口 -export serverPort=5000 +export clientPort=5000 #客户端监听地址 export listenAddress=0.0.0.0 #服务端访问地址