mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix adding route if already existing
This commit is contained in:
parent
ec93142814
commit
c968476130
1 changed files with 9 additions and 3 deletions
|
@ -166,9 +166,14 @@ while true; do
|
||||||
if [ "$OMR_TRACKER_TYPE" = "none" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "none" ]; then
|
||||||
OMR_TRACKER_STATUS="OK"
|
OMR_TRACKER_STATUS="OK"
|
||||||
else
|
else
|
||||||
|
# Check if route is not used
|
||||||
|
while ! ip route add $OMR_TRACKER_HOST via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE src $OMR_TRACKER_DEVICE_IP > /dev/null 2&>1
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
_restart
|
||||||
|
done
|
||||||
# setup loop variable
|
# setup loop variable
|
||||||
tries="$OMR_TRACKER_TRIES"
|
tries="$OMR_TRACKER_TRIES"
|
||||||
ip route replace "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP"
|
|
||||||
# loop until tries attempts have been reached
|
# loop until tries attempts have been reached
|
||||||
while [ "$tries" -gt 0 ]; do
|
while [ "$tries" -gt 0 ]; do
|
||||||
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
|
||||||
|
@ -195,7 +200,8 @@ while true; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$OMR_TRACKER_HOSTS" = "$initial_hosts" ] || [ "$OMR_TRACKER_STATUS" = "OK" ] && _post_tracking
|
[ "$OMR_TRACKER_HOSTS" = "$initial_hosts" ] || [ "$OMR_TRACKER_STATUS" = "OK" ] && _post_tracking
|
||||||
[ "$OMR_TRACKER_STATUS" = "ERROR" ] && _restart
|
#[ "$OMR_TRACKER_STATUS" = "ERROR" ] && _restart
|
||||||
|
_restart
|
||||||
|
|
||||||
sleep "$OMR_TRACKER_INTERVAL"
|
sleep "$OMR_TRACKER_INTERVAL"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue