mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Test gateway before all
This commit is contained in:
parent
6dcc086948
commit
f9adb2e523
1 changed files with 25 additions and 19 deletions
|
@ -79,7 +79,6 @@ _restart
|
||||||
while true; do
|
while true; do
|
||||||
# setup tracker variables
|
# setup tracker variables
|
||||||
OMR_TRACKER_DEVICE_IP=
|
OMR_TRACKER_DEVICE_IP=
|
||||||
OMR_TRACKER_DEVICE_GATEWAY=
|
|
||||||
OMR_TRACKER_STATUS="ERROR"
|
OMR_TRACKER_STATUS="ERROR"
|
||||||
OMR_TRACKER_LATENCY=
|
OMR_TRACKER_LATENCY=
|
||||||
OMR_TRACKER_TIMEOUT=$((rto / 1000 + (rto % 1000 ? 1 : 0)))
|
OMR_TRACKER_TIMEOUT=$((rto / 1000 + (rto % 1000 ? 1 : 0)))
|
||||||
|
@ -90,6 +89,12 @@ while true; do
|
||||||
|
|
||||||
# execute specific tracker
|
# execute specific tracker
|
||||||
if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then
|
if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then
|
||||||
|
retgw=$(ping "$OMR_TRACKER_DEVICE_GATEWAY" \
|
||||||
|
-I "$OMR_TRACKER_DEVICE_IP" \
|
||||||
|
-w 1 \
|
||||||
|
-c 1 \
|
||||||
|
-q
|
||||||
|
) && echo "$retgw" | grep -sq "0% packet loss" && {
|
||||||
# setup loop variable
|
# setup loop variable
|
||||||
tries="$OMR_TRACKER_TRIES"
|
tries="$OMR_TRACKER_TRIES"
|
||||||
# loop until tries attempts have been reached
|
# loop until tries attempts have been reached
|
||||||
|
@ -108,6 +113,7 @@ while true; do
|
||||||
tries=$((tries - 1))
|
tries=$((tries - 1))
|
||||||
OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
|
OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
|
||||||
done
|
done
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue