luci ssr plus: ssr-monitor pdnsd status

This commit is contained in:
coolsnowwolf 2018-11-26 14:55:17 +08:00
parent a5532b9697
commit bb81f14df0
3 changed files with 20 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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
@ -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