From 6b436da071298ddc3fa3e63e5e984bee3d0bb5c3 Mon Sep 17 00:00:00 2001 From: bluepongo <563091001@qq.com> Date: Thu, 13 Oct 2022 17:33:19 +0800 Subject: [PATCH] modify 3.1.0-odbproxyd.sh --- plugins/obproxy/3.1.0/obproxyd.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/plugins/obproxy/3.1.0/obproxyd.sh b/plugins/obproxy/3.1.0/obproxyd.sh index bd9b126..1024334 100644 --- a/plugins/obproxy/3.1.0/obproxyd.sh +++ b/plugins/obproxy/3.1.0/obproxyd.sh @@ -8,31 +8,24 @@ function start() { obproxy_path=$path/run/obproxy-$ip-$port.pid cat $obproxyd_path | xargs kill -9 - echo $$ > $obproxyd_path if [ $? != 0 ]; then exit $? fi pid=`cat $obproxy_path` + echo $pid ls /proc/$pid > /dev/null - if [ $? != 0 ]; then - exit $? - fi - kill -9 $pid while [ 1 ]; do sleep 1 - ls /proc/$pid > /dev/null - if [ $? != 0 ]; then + count=`ps -aux | egrep "$path/bin/obproxy --listen_port 2883" | grep -v grep |wc -l` + if [[ $count == 0 ]];then cd $path $path/bin/obproxy --listen_port $port pid=`ps -aux | egrep "$path/bin/obproxy --listen_port $port$" | grep -v grep | awk '{print $2}'` echo $pid > $obproxy_path - if [ $? != 0 ]; then - exit $? - fi fi done } @@ -42,4 +35,6 @@ then start else nohup bash $0 $path $ip $port daemon > /dev/null 2>&1 & -fi \ No newline at end of file + +fi +