1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix tracker and add default config for tunnel

This commit is contained in:
Ycarus 2018-03-25 20:48:48 +02:00
parent 1454020a47
commit 3ae780bcf8
2 changed files with 40 additions and 26 deletions

View file

@ -163,32 +163,33 @@ while true; do
_ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE_IP" "no" _ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE_IP" "no"
status=$? status=$?
if $(exit $status); then if $(exit $status); then
# setup loop variable if [ "$OMR_TRACKER_TYPE" = "none" ]; then
tries="$OMR_TRACKER_TRIES" OMR_TRACKER_STATUS="OK"
ip route replace "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP" else
# loop until tries attempts have been reached # setup loop variable
while [ "$tries" -gt 0 ]; do tries="$OMR_TRACKER_TRIES"
if [ "$OMR_TRACKER_TYPE" = "ping" ]; then ip route replace "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP"
_ping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes" # loop until tries attempts have been reached
status=$? while [ "$tries" -gt 0 ]; do
elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then if [ "$OMR_TRACKER_TYPE" = "ping" ]; then
_httping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes" _ping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
status=$? status=$?
elif [ "$OMR_TRACKER_TYPE" = "dns" ]; then elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then
_dns "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes" _httping "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
status=$? status=$?
elif [ "$OMR_TRACKER_TYPE" = "none" ]; then elif [ "$OMR_TRACKER_TYPE" = "dns" ]; then
_none _dns "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
status=$? status=$?
fi fi
if $(exit $status); then if $(exit $status); then
OMR_TRACKER_STATUS="OK" OMR_TRACKER_STATUS="OK"
break break
fi fi
tries=$((tries - 1)) tries=$((tries - 1))
OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2)) OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
done done
ip route del "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP" ip route del "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP" > /dev/null 2&>1
fi
fi fi
fi fi
fi fi

View file

@ -0,0 +1,13 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
set omr-tracker.tun0=interface
set omr-tracker.tun0.type="none"
set omr-tracker.tun0.timeout=1
set omr-tracker.tun0.tries=4
set omr-tracker.tun0.interval=2
commit omr-tracker
EOF
rm -f /tmp/luci-indexcache
exit 0