mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Fix Shadowsocks status test
This commit is contained in:
		
							parent
							
								
									77a7644ad2
								
							
						
					
					
						commit
						7e851fc9b7
					
				
					 3 changed files with 14 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=omr-tracker
 | 
			
		||||
PKG_VERSION:=1.5
 | 
			
		||||
PKG_VERSION:=1.6
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,20 +19,17 @@ nodns=0
 | 
			
		|||
last=0
 | 
			
		||||
 | 
			
		||||
while true; do
 | 
			
		||||
	while [ "$last" -gt 0 ]; do
 | 
			
		||||
		host=${hosts%% *}
 | 
			
		||||
		if curl -s --socks5 "${proxy}" --max-time "${timeout}" "$host" &>/dev/null ; then
 | 
			
		||||
			[ "${last}" -gt 0 ] && log "Shadowsocks is up (can contact ${host})"
 | 
			
		||||
			/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
 | 
			
		||||
			last=0
 | 
			
		||||
		else
 | 
			
		||||
			last=$((last + 1 ))
 | 
			
		||||
			[ "${last}" -ge "${retry}" ] && {
 | 
			
		||||
				log "Shadowsocks is down (can't contact ${host})"
 | 
			
		||||
				/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
 | 
			
		||||
				last=0
 | 
			
		||||
			}
 | 
			
		||||
		fi
 | 
			
		||||
	done
 | 
			
		||||
	host=${hosts%% *}
 | 
			
		||||
	if curl -s --socks5 "${proxy}" --max-time "${timeout}" "$host" &>/dev/null ; then
 | 
			
		||||
		[ "${last}" -gt 0 ] && log "Shadowsocks is up (can contact ${host})"
 | 
			
		||||
		/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
 | 
			
		||||
		last=0
 | 
			
		||||
	else
 | 
			
		||||
		last=$((last + 1 ))
 | 
			
		||||
		[ "${last}" -eq "${retry}" ] && {
 | 
			
		||||
			log "Shadowsocks is down (can't contact ${host})"
 | 
			
		||||
			/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
 | 
			
		||||
		}
 | 
			
		||||
	fi
 | 
			
		||||
	sleep "${interval}"
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ _launch_tracker() {
 | 
			
		|||
	config_get multipath "$1" multipath
 | 
			
		||||
	config_get gateway "$1" gateway
 | 
			
		||||
 | 
			
		||||
	[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && return
 | 
			
		||||
	[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && return
 | 
			
		||||
	[ "${enabled}" = "0" ] && return
 | 
			
		||||
 | 
			
		||||
	procd_open_instance
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue