mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Ping via interface instead of IP only
This commit is contained in:
parent
403488eb53
commit
61bc8cf0b7
2 changed files with 10 additions and 10 deletions
|
@ -77,9 +77,9 @@ _post_tracking() {
|
|||
|
||||
_ping_server() {
|
||||
local serverip=$(uci -q get openmptcprouter.$1.ip)
|
||||
local deviceip=$2
|
||||
if [ -n "$serverip" ] && [ -n "$deviceip" ]; then
|
||||
_ping $serverip $deviceip "yes"
|
||||
local device=$2
|
||||
if [ -n "$serverip" ] && [ -n "$device" ]; then
|
||||
_ping $serverip $device "yes"
|
||||
statusp=$?
|
||||
if $(exit $statusp); then
|
||||
serverip_ping=true
|
||||
|
@ -91,9 +91,9 @@ _ping_server() {
|
|||
|
||||
_ping() {
|
||||
local host=$1
|
||||
local deviceip=$2
|
||||
local device=$2
|
||||
local localip=$3
|
||||
ret=$(ping -I "${deviceip}" \
|
||||
ret=$(ping -B -I "${device}" \
|
||||
-w "$OMR_TRACKER_TIMEOUT" \
|
||||
-c 1 \
|
||||
-q \
|
||||
|
@ -200,7 +200,7 @@ while true; do
|
|||
tries="$OMR_TRACKER_TRIES"
|
||||
# loop until tries attempts have been reached
|
||||
while [ "$tries" -gt 0 ]; do
|
||||
_ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE_IP" "no"
|
||||
_ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE" "no"
|
||||
status=$?
|
||||
if $(exit $status) && [ "$OMR_TRACKER_TYPE" = "none" ]; then
|
||||
OMR_TRACKER_STATUS_MSG=""
|
||||
|
@ -213,7 +213,7 @@ while true; do
|
|||
serverip_ping=false
|
||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||
config_load openmptcprouter
|
||||
config_foreach _ping_server server $OMR_TRACKER_DEVICE_IP
|
||||
config_foreach _ping_server server $OMR_TRACKER_DEVICE
|
||||
fi
|
||||
if [ "$serverip_ping" = false ]; then
|
||||
# Check if route is not used
|
||||
|
@ -225,7 +225,7 @@ while true; do
|
|||
_restart
|
||||
done
|
||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||
_ping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
|
||||
_ping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE" "yes"
|
||||
statusb=$?
|
||||
elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then
|
||||
_httping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue