|
|
@ -2,9 +2,37 @@ |
|
|
|
# 检查客户端和服务端端口是否存在 |
|
|
|
# 检查客户端和服务端端口是否存在 |
|
|
|
#存在返回0否则返回1 |
|
|
|
#存在返回0否则返回1 |
|
|
|
source /app/riskenv |
|
|
|
source /app/riskenv |
|
|
|
if [[ ! -z "`/app/findPortPid $PORT`" && ! -z "`/app/findPortPid $serverPort`" ]] |
|
|
|
|
|
|
|
|
|
|
|
log=/var/log/checkPort.log |
|
|
|
|
|
|
|
function foo() { |
|
|
|
|
|
|
|
echo $1>>$log |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function test(){ |
|
|
|
|
|
|
|
check=0 |
|
|
|
|
|
|
|
foo "=====================start check=====================" |
|
|
|
|
|
|
|
if [ -z "`/app/findPortPid $PORT`" ] |
|
|
|
then |
|
|
|
then |
|
|
|
echo 0 |
|
|
|
foo "server status:stop" |
|
|
|
|
|
|
|
check=1 |
|
|
|
else |
|
|
|
else |
|
|
|
echo 1 |
|
|
|
foo "server status:start" |
|
|
|
fi |
|
|
|
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 $? |