mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Check var exist on omr-tracker
This commit is contained in:
parent
95ea617630
commit
43865452a5
2 changed files with 9 additions and 4 deletions
|
@ -92,6 +92,7 @@ _post_tracking() {
|
||||||
|
|
||||||
_ping_server() {
|
_ping_server() {
|
||||||
local servername=$1
|
local servername=$1
|
||||||
|
[ -z "$servername" ] && return
|
||||||
local disabled=$(uci -q get openmptcprouter.$1.disabled)
|
local disabled=$(uci -q get openmptcprouter.$1.disabled)
|
||||||
local device=$2
|
local device=$2
|
||||||
if [ -n "$device" ] && [ "$disabled" != "1" ]; then
|
if [ -n "$device" ] && [ "$disabled" != "1" ]; then
|
||||||
|
@ -113,6 +114,7 @@ _ping_server() {
|
||||||
|
|
||||||
_httping_server() {
|
_httping_server() {
|
||||||
local servername=$1
|
local servername=$1
|
||||||
|
[ -z "$servername" ] && return
|
||||||
local disabled=$(uci -q get openmptcprouter.$1.disabled)
|
local disabled=$(uci -q get openmptcprouter.$1.disabled)
|
||||||
local port=$(uci -q get openmptcprouter.$1.port)
|
local port=$(uci -q get openmptcprouter.$1.port)
|
||||||
local device=$2
|
local device=$2
|
||||||
|
@ -135,9 +137,10 @@ _httping_server() {
|
||||||
|
|
||||||
_ping() {
|
_ping() {
|
||||||
local host=$1
|
local host=$1
|
||||||
|
[ -z "$host" ] && return
|
||||||
local device=$2
|
local device=$2
|
||||||
local localip=$3
|
local localip=$3
|
||||||
if [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "3g" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "qmi" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "ncm" ]; then
|
if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "3g" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "qmi" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "ncm" ]); then
|
||||||
ret=$(ping -I "${device}" \
|
ret=$(ping -I "${device}" \
|
||||||
-w "$OMR_TRACKER_TIMEOUT" \
|
-w "$OMR_TRACKER_TIMEOUT" \
|
||||||
-c 2 \
|
-c 2 \
|
||||||
|
@ -222,7 +225,7 @@ _none() {
|
||||||
|
|
||||||
_restart
|
_restart
|
||||||
|
|
||||||
OMR_TRACKER_INTERFACE_PROTO="$(uci -q get network.${OMR_TRACKER_INTERFACE_PROTO}.proto)"
|
OMR_TRACKER_INTERFACE_PROTO="$(uci -q get network.${OMR_TRACKER_INTERFACE}.proto)"
|
||||||
OMR_TRACKER_PREV_STATUS=""
|
OMR_TRACKER_PREV_STATUS=""
|
||||||
# main loop
|
# main loop
|
||||||
while true; do
|
while true; do
|
||||||
|
|
|
@ -48,7 +48,7 @@ _launch_tracker() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
loopback|lan*|if0*) return;;
|
loopback|lan*|if0*) return;;
|
||||||
esac
|
esac
|
||||||
|
[ -z "$1" ] && return
|
||||||
local hosts hosts6 timeout tries interval interval_tries options type enabled wait_test ipv6 proto server_http_test
|
local hosts hosts6 timeout tries interval interval_tries options type enabled wait_test ipv6 proto server_http_test
|
||||||
_validate_section "defaults" "defaults"
|
_validate_section "defaults" "defaults"
|
||||||
_validate_section "interface" "$1"
|
_validate_section "interface" "$1"
|
||||||
|
@ -152,6 +152,7 @@ _initialize_shadowsocks_tracker() {
|
||||||
server=$1
|
server=$1
|
||||||
|
|
||||||
[ -n "$(echo $server | grep sss)" ] || return
|
[ -n "$(echo $server | grep sss)" ] || return
|
||||||
|
[ -z "$server" ] && return
|
||||||
|
|
||||||
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
||||||
#config_get tracker_server ss_rules server
|
#config_get tracker_server ss_rules server
|
||||||
|
@ -199,7 +200,8 @@ _launch_shadowsocks_tracker() {
|
||||||
config_get server "$1" server
|
config_get server "$1" server
|
||||||
|
|
||||||
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
|
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
|
||||||
[ -z "$server" ] || [ "$(uci -q get shadowsocks-libev.$server.server)" = "192.168.1.3" ] || [ "$(uci -q get shadowsocks-libev.$server.server)" = "" ] && return
|
[ -z "$server" ] && return
|
||||||
|
[ "$(uci -q get shadowsocks-libev.$server.server)" = "192.168.1.3" ] || [ "$(uci -q get shadowsocks-libev.$server.server)" = "" ] && return
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue