1
0
Fork 0
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:
Ycarus (Yannick Chabanois) 2022-02-09 20:38:43 +01:00
parent 95ea617630
commit 43865452a5
2 changed files with 9 additions and 4 deletions

View file

@ -92,6 +92,7 @@ _post_tracking() {
_ping_server() {
local servername=$1
[ -z "$servername" ] && return
local disabled=$(uci -q get openmptcprouter.$1.disabled)
local device=$2
if [ -n "$device" ] && [ "$disabled" != "1" ]; then
@ -113,6 +114,7 @@ _ping_server() {
_httping_server() {
local servername=$1
[ -z "$servername" ] && return
local disabled=$(uci -q get openmptcprouter.$1.disabled)
local port=$(uci -q get openmptcprouter.$1.port)
local device=$2
@ -135,9 +137,10 @@ _httping_server() {
_ping() {
local host=$1
[ -z "$host" ] && return
local device=$2
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}" \
-w "$OMR_TRACKER_TIMEOUT" \
-c 2 \
@ -222,7 +225,7 @@ _none() {
_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=""
# main loop
while true; do