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