mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add option to restart interface if down
This commit is contained in:
parent
6dbf7cc73c
commit
7e07f63967
3 changed files with 23 additions and 0 deletions
|
@ -134,6 +134,13 @@ o.default = false
|
|||
o.disabled = 0
|
||||
o.enabled = 1
|
||||
|
||||
o = s:option(Flag, "restart_down", translate("Restart if down"), translate("Restart interface if detected as down"))
|
||||
o.optional = false
|
||||
o.rmempty = false
|
||||
o.default = false
|
||||
o.disabled = 0
|
||||
o.enabled = 1
|
||||
|
||||
o = s:option(DynamicList, "hosts", translate("Hosts"), translate("Must be IPs and not domains"))
|
||||
o.placeholder = "4.2.2.1"
|
||||
o.default = { "4.2.2.1", "8.8.8.8" }
|
||||
|
@ -202,6 +209,13 @@ o.default = false
|
|||
o.disabled = 0
|
||||
o.enabled = 1
|
||||
|
||||
o = s:option(Flag, "restart_down", translate("Restart if down"), translate("Restart interface if detected as down"))
|
||||
o.optional = false
|
||||
o.rmempty = false
|
||||
o.default = false
|
||||
o.disabled = 0
|
||||
o.enabled = 1
|
||||
|
||||
o = s:option(DynamicList, "hosts", translate("Hosts"), translate("Must be IPs and not domains"))
|
||||
o.placeholder = "4.2.2.1"
|
||||
o.default = { "4.2.2.1", "8.8.8.8" }
|
||||
|
|
|
@ -678,6 +678,14 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
script_alert_down="$(uci -q get omr-tracker.$OMR_TRACKER_INTERFACE.script_alert_down)"
|
||||
[ -n "$script_alert_down" ] && eval $script_alert_down
|
||||
|
||||
restart_down="$(uci -q get omr-tracker.$OMR_TRACKER_INTERFACE.restart_down)"
|
||||
[ -z "$restart_down" ] && restart_down="$(uci -q get omr-tracker.defaults.restart_down)"
|
||||
[ "$restart_down" = "1" ] && {
|
||||
ifdown $OMR_TRACKER_INTERFACE 2>&1 >/dev/null
|
||||
sleep 5
|
||||
ifup $OMR_TRACKER_INTERFACE 2>&1 >/dev/null
|
||||
}
|
||||
|
||||
if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ]; then
|
||||
if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then
|
||||
_log "$OMR_TRACKER_INTERFACE down"
|
||||
|
|
|
@ -24,6 +24,7 @@ config defaults 'defaults'
|
|||
option type 'ping'
|
||||
option wait_test '0'
|
||||
option server_http_test '1'
|
||||
option restart_down '0'
|
||||
option options ''
|
||||
|
||||
config proxy 'proxy'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue