Skip to content

Commit

Permalink
luci ssr plus: ssr-monitor pdnsd status
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Nov 26, 2018
1 parent a5532b9 commit bb81f14
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package/lean/luci-app-ssr-plus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=1
PKG_RELEASE:=61
PKG_RELEASE:=62

PO2LMO:=$(STAGING_DIR_HOSTPKG)/bin/po2lmo

Expand Down
4 changes: 2 additions & 2 deletions package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,11 @@ EOF
add_cron

if [ $(uci_get_by_type global monitor_enable) = 1 ] ;then
let total_count=server_count+redir_tcp+redir_udp+tunnel_enable+kcp_enable_flag+local_enable+dns_enable_flag+switch_enable
let total_count=server_count+redir_tcp+redir_udp+tunnel_enable+kcp_enable_flag+local_enable+pdnsd_enable_flag+switch_enable
if [ $total_count -gt 0 ]
then
#param:server(count) redir_tcp(0:no,1:yes) redir_udp tunnel kcp local gfw
service_start /usr/bin/ssr-monitor $server_count $redir_tcp $redir_udp $tunnel_enable $kcp_enable_flag $local_enable $dns_enable_flag $switch_enable
service_start /usr/bin/ssr-monitor $server_count $redir_tcp $redir_udp $tunnel_enable $kcp_enable_flag $local_enable $pdnsd_enable_flag $switch_enable
fi
fi

Expand Down
30 changes: 17 additions & 13 deletions package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ redir_udp_process=$3
tunnel_process=$4
kcp_process=$5
local_process=$6
dns_process=$7
if [ -z "$dns_process" ] ;then
dns_process=0
pdnsd_process=$7
if [ -z "$pdnsd_process" ] ;then
pdnsd_process=0
fi

i=0
Expand Down Expand Up @@ -114,15 +114,19 @@ do
( /usr/bin/ssr-local -c /var/etc/shadowsocksr_s.json -u -l $sock5_port -f /var/run/ssr-local.pid &)
fi
fi
#dns
if [ $dns_process -gt 0 ] ;then
icount=`ps -w | grep ssr-dns |grep -v grep| wc -l`
if [ $icount -lt $dns_process ] #如果进程挂掉就重启它
then
logger -t "$NAME" "ssr dns tunnel error.restart!"
killall -q -9 ssr-tunnel
#pdnsd
if [ $pdnsd_process -gt 0 ] ;then
icount=`ps -w | grep pdnsd |grep -v grep| wc -l`
if [ $icount -lt $pdnsd_process ] #如果进程挂掉就重启它
then
logger -t "$NAME" "pdnsd tunnel error.restart!"
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
fi

( /usr/bin/ssr-tunnel -c /var/etc/shadowsocksr.json -b 0.0.0.0 -u -l 5353 -L $(uci_get_by_type global tunnel_forward 8.8.4.4:53) -f /var/run/ssr-dns.pid &)
fi
fi
( /usr/sbin/pdnsd -c /var/etc/pdnsd.conf -d &)
fi
fi
done

0 comments on commit bb81f14

Please sign in to comment.