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 +