From 072ed9f80c43e5defb3668cb3f751e0c801fd380 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sun, 13 Oct 2019 22:17:10 -0700 Subject: [PATCH] luci-app-ssr-plus: compatible with proc-ng-ps --- package/lean/luci-app-ssr-plus/Makefile | 2 +- .../luasrc/controller/shadowsocksr.lua | 2 +- .../luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 6 +++--- .../luci-app-ssr-plus/root/usr/bin/ssr-monitor | 14 +++++++------- .../lean/luci-app-ssr-plus/root/usr/bin/ssr-switch | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index b5231681b..1a8bcb8b3 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=1 -PKG_RELEASE:=105 +PKG_RELEASE:=106 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \ diff --git a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua index f819c74f8..524bf67d3 100644 --- a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua +++ b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua @@ -41,7 +41,7 @@ end function act_status() local e={} - e.running=luci.sys.call("ps -w | grep ssr-retcp | grep -v grep >/dev/null")==0 + e.running=luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 43b50b47b..1f6cbec8d 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -527,10 +527,10 @@ stop() { iptables -X SSR-SERVER-RULE 2>/dev/null fi if [ -z "$switch_server" ] ;then - kill -9 $(ps | grep ssr-switch | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + kill -9 $(busybox ps -w | grep ssr-switch | grep -v grep | awk '{print $1}') >/dev/null 2>&1 fi if [ $(uci_get_by_type global monitor_enable) = 1 ] ;then - kill -9 $(ps | grep ssr-monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + kill -9 $(busybox ps -w | grep ssr-monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1 fi killall -q -9 ssr-monitor killall -q -9 ss-redir @@ -542,7 +542,7 @@ stop() { if [ -f /var/run/pdnsd.pid ] ;then kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1 else - kill -9 $(ps | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 fi if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor index 60c34ee55..abf077f57 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor @@ -54,7 +54,7 @@ do sleep 30 #redir tcp if [ $redir_tcp_process -gt 0 ] ;then - icount=`ps -w | grep ssr-retcp |grep -v grep| wc -l` + icount=`busybox ps -w | grep ssr-retcp |grep -v grep| wc -l` if [ $icount = 0 ] ;then logger -t "$NAME" "ssr redir tcp error.restart!" /etc/init.d/shadowsocksr restart @@ -63,7 +63,7 @@ do fi #redir udp if [ $redir_udp_process -gt 0 ] ;then - icount=`ps -w | grep ssr-reudp|grep -v grep| wc -l` + icount=`busybox ps -w | grep ssr-reudp|grep -v grep| wc -l` if [ $icount = 0 ] ;then logger -t "$NAME" "ssr redir udp error.restart!" /etc/init.d/shadowsocksr restart @@ -72,7 +72,7 @@ do fi #tunnel if [ $tunnel_process -gt 0 ] ;then - icount=`ps -w | grep ssr-tunnel |grep -v grep| wc -l` + icount=`busybox ps -w | grep ssr-tunnel |grep -v grep| wc -l` if [ $icount = 0 ] ;then logger -t "$NAME" "ssr tunnel error.restart!" /etc/init.d/shadowsocksr restart @@ -81,7 +81,7 @@ do fi #server if [ $server_process_count -gt 0 ] ;then - icount=`ps -w | grep ssr-server |grep -v grep| wc -l` + icount=`busybox ps -w | grep ssr-server |grep -v grep| wc -l` if [ $icount -lt $server_process_count ] #如果进程挂掉就重启它 then logger -t "$NAME" "ssr server error.restart!" @@ -94,7 +94,7 @@ do fi #kcptun if [ $kcp_process -gt 0 ] ;then - icount=`ps -w | grep kcptun-client |grep -v grep| wc -l` + icount=`busybox ps -w | grep kcptun-client |grep -v grep| wc -l` if [ $icount -lt $kcp_process ] #如果进程挂掉就重启它 then logger -t "$NAME" "ssr kcptun error.restart!" @@ -105,7 +105,7 @@ do fi #local if [ $local_process -gt 0 ] ;then - icount=`ps -w | grep ssr-local |grep -v grep| wc -l` + icount=`busybox ps -w | grep ssr-local |grep -v grep| wc -l` if [ $icount -lt $local_process ] #如果进程挂掉就重启它 then logger -t "$NAME" "ssr local error.restart!" @@ -116,7 +116,7 @@ do fi #pdnsd if [ $pdnsd_process -gt 0 ] ;then - icount=`ps -w | grep pdnsd |grep -v grep| wc -l` + icount=`busybox ps -w | grep pdnsd |grep -v grep| wc -l` if [ $icount -lt $pdnsd_process ] #如果进程挂掉就重启它 then logger -t "$NAME" "pdnsd tunnel error.restart!" diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch index 281d0f851..9be20f019 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch @@ -135,7 +135,7 @@ do #缂虹渷鏈嶅姟鍣ㄦ甯革紝鍒囨崲鍥炴潵 CURRENT_SERVER=$DEFAULT_SERVER switch_proxy $CURRENT_SERVER - echo "switch to default ["$(uci_get_by_name $CURRENT_SERVER server)"] proxy!" >> /tmp/ssrplus.log + echo "$(date "+%Y-%m-%d %H:%M:%S") switch to default ["$(uci_get_by_name $CURRENT_SERVER server)"] proxy!" >> /tmp/ssrplus.log continue else echo "$(date "+%Y-%m-%d %H:%M:%S") Main server is NOT avilable.Continue using current server." >> /tmp/ssrplus.log