mirror of
https://github.com/gSpotx2f/luci-app-internet-detector.git
synced 2025-12-06 03:26:50 +03:00
mod_network_restart, mod_modem_restart, mod_user_scripts: New option attempt_interval.
This commit is contained in:
30
README.md
30
README.md
@@ -17,22 +17,22 @@ Internet-detector is an application for checking the availability of the Interne
|
||||
## Installation notes:
|
||||
|
||||
opkg update
|
||||
wget --no-check-certificate -O /tmp/internet-detector_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.5.0-r1_all.ipk
|
||||
opkg install /tmp/internet-detector_1.5.0-r1_all.ipk
|
||||
rm /tmp/internet-detector_1.5.0-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.5.1-r1_all.ipk
|
||||
opkg install /tmp/internet-detector_1.5.1-r1_all.ipk
|
||||
rm /tmp/internet-detector_1.5.1-r1_all.ipk
|
||||
service internet-detector start
|
||||
service internet-detector enable
|
||||
|
||||
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.5.0-r1_all.ipk
|
||||
opkg install /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk
|
||||
rm /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.5.1-r1_all.ipk
|
||||
opkg install /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk
|
||||
rm /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk
|
||||
service rpcd restart
|
||||
|
||||
i18n-ru:
|
||||
|
||||
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk
|
||||
opkg install /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk
|
||||
rm /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
|
||||
opkg install /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
|
||||
rm /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
|
||||
|
||||
## Screenshots:
|
||||
|
||||
@@ -44,9 +44,9 @@ i18n-ru:
|
||||
|
||||
**Dependences:** modemmanager.
|
||||
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
|
||||
service internet-detector restart
|
||||
|
||||

|
||||
@@ -55,9 +55,9 @@ i18n-ru:
|
||||
|
||||
**Dependences:** mailsend.
|
||||
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.5.0-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.5.1-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk
|
||||
service internet-detector restart
|
||||
|
||||

|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-email
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-modem-restart
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -5,27 +5,29 @@
|
||||
local unistd = require("posix.unistd")
|
||||
|
||||
local Module = {
|
||||
name = "mod_modem_restart",
|
||||
runPrio = 40,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
mmcli = "/usr/bin/mmcli",
|
||||
mmInit = "/etc/init.d/modemmanager",
|
||||
deadPeriod = 600,
|
||||
attempts = 1,
|
||||
ifaceTimeout = 0,
|
||||
iface = nil,
|
||||
anyBand = false,
|
||||
status = nil,
|
||||
_enabled = false,
|
||||
_attemptsCounter = 0,
|
||||
_deadCounter = 0,
|
||||
_modemRestarted = false,
|
||||
_ifaceRestarting = false,
|
||||
_ifaceRestartCounter = 0,
|
||||
_disconnectedAtStartup = false,
|
||||
name = "mod_modem_restart",
|
||||
runPrio = 40,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
mmcli = "/usr/bin/mmcli",
|
||||
mmInit = "/etc/init.d/modemmanager",
|
||||
deadPeriod = 600,
|
||||
attempts = 1,
|
||||
attemptInterval = 15,
|
||||
ifaceTimeout = 0,
|
||||
iface = nil,
|
||||
anyBand = false,
|
||||
status = nil,
|
||||
_enabled = false,
|
||||
_attemptsCounter = 0,
|
||||
_attemptIntervalCounter = 0,
|
||||
_deadCounter = 0,
|
||||
_firstAttempt = true,
|
||||
_ifaceRestarting = false,
|
||||
_ifaceRestartCounter = 0,
|
||||
_disconnectedAtStartup = false,
|
||||
}
|
||||
|
||||
function Module:toggleIface(flag)
|
||||
@@ -38,11 +40,14 @@ function Module:toggleIface(flag)
|
||||
end
|
||||
|
||||
function Module:init(t)
|
||||
if t.dead_period ~= nil then
|
||||
self.deadPeriod = tonumber(t.dead_period)
|
||||
end
|
||||
if t.attempts ~= nil then
|
||||
self.attempts = tonumber(t.attempts)
|
||||
end
|
||||
if t.dead_period ~= nil then
|
||||
self.deadPeriod = tonumber(t.dead_period)
|
||||
if t.attempt_interval ~= nil then
|
||||
self.attemptInterval = tonumber(t.attempt_interval)
|
||||
end
|
||||
if t.iface ~= nil then
|
||||
self.iface = t.iface
|
||||
@@ -115,24 +120,25 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
else
|
||||
if currentStatus == 1 then
|
||||
if not self._modemRestarted then
|
||||
if self._disconnectedAtStartup and (self.attempts == 0 or self._attemptsCounter < self.attempts) then
|
||||
if self._deadCounter >= self.deadPeriod then
|
||||
if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
|
||||
if self.attempts == 0 or self._attemptsCounter < self.attempts then
|
||||
if self._firstAttempt or self._attemptIntervalCounter >= self.attemptInterval then
|
||||
self:restartMM()
|
||||
self._modemRestarted = true
|
||||
self._deadCounter = 0
|
||||
self._attemptIntervalCounter = 0
|
||||
self._firstAttempt = false
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
self._attemptIntervalCounter = self._attemptIntervalCounter + timeDiff
|
||||
end
|
||||
end
|
||||
elseif inetChecked and (self.attempts == 0 or self._attemptsCounter < self.attempts) then
|
||||
self:restartMM()
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
end
|
||||
else
|
||||
self._attemptsCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._modemRestarted = false
|
||||
self._attemptsCounter = 0
|
||||
self._attemptIntervalCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._firstAttempt = true
|
||||
end
|
||||
self._ifaceRestartCounter = 0
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -22,11 +22,13 @@ config instance 'internet'
|
||||
option mod_network_restart_disconnected_at_startup '0'
|
||||
option mod_network_restart_dead_period '900'
|
||||
option mod_network_restart_attempts '1'
|
||||
option mod_network_restart_restart_timeout '0'
|
||||
option mod_network_restart_attempt_interval '15'
|
||||
option mod_network_restart_device_timeout '0'
|
||||
option mod_modem_restart_enabled '0'
|
||||
option mod_modem_restart_disconnected_at_startup '0'
|
||||
option mod_modem_restart_dead_period '600'
|
||||
option mod_modem_restart_attempts '1'
|
||||
option mod_modem_restart_attempt_interval '15'
|
||||
option mod_modem_restart_iface_timeout '0'
|
||||
option mod_modem_restart_any_band '0'
|
||||
option mod_public_ip_enabled '0'
|
||||
@@ -45,9 +47,11 @@ config instance 'internet'
|
||||
option mod_user_scripts_enabled '0'
|
||||
option mod_user_scripts_alive_period '0'
|
||||
option mod_user_scripts_up_script_attempts '1'
|
||||
option mod_user_scripts_up_script_attempt_interval '15'
|
||||
option mod_user_scripts_connected_at_startup '0'
|
||||
option mod_user_scripts_dead_period '0'
|
||||
option mod_user_scripts_down_script_attempts '1'
|
||||
option mod_user_scripts_down_script_attempt_interval '15'
|
||||
option mod_user_scripts_disconnected_at_startup '0'
|
||||
option mod_regular_script_enabled '0'
|
||||
option mod_regular_script_inet_state '2'
|
||||
|
||||
@@ -2,25 +2,27 @@
|
||||
local unistd = require("posix.unistd")
|
||||
|
||||
local Module = {
|
||||
name = "mod_network_restart",
|
||||
runPrio = 30,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
deadPeriod = 900,
|
||||
attempts = 1,
|
||||
restartTimeout = 0,
|
||||
status = nil,
|
||||
_attemptsCounter = 0,
|
||||
_deadCounter = 0,
|
||||
_networkRestarted = false,
|
||||
_ifaceRestarting = false,
|
||||
_ifaceRestartCounter = 0,
|
||||
_netIfaces = {},
|
||||
_netDevices = {},
|
||||
_netItemsNum = 0,
|
||||
_disconnectedAtStartup = false,
|
||||
name = "mod_network_restart",
|
||||
runPrio = 30,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
deadPeriod = 900,
|
||||
attempts = 1,
|
||||
attemptInterval = 15,
|
||||
deviceTimeout = 0,
|
||||
status = nil,
|
||||
_attemptsCounter = 0,
|
||||
_attemptIntervalCounter = 0,
|
||||
_deadCounter = 0,
|
||||
_firstAttempt = true,
|
||||
_ifaceRestarting = false,
|
||||
_ifaceRestartCounter = 0,
|
||||
_netIfaces = {},
|
||||
_netDevices = {},
|
||||
_netItemsNum = 0,
|
||||
_disconnectedAtStartup = false,
|
||||
}
|
||||
|
||||
function Module:toggleDevices(flag)
|
||||
@@ -72,15 +74,17 @@ function Module:init(t)
|
||||
self._netItemsNum = self._netItemsNum + 1
|
||||
end
|
||||
end
|
||||
|
||||
if t.attempts ~= nil then
|
||||
self.attempts = tonumber(t.attempts)
|
||||
end
|
||||
if t.dead_period ~= nil then
|
||||
self.deadPeriod = tonumber(t.dead_period)
|
||||
end
|
||||
if t.restart_timeout ~= nil then
|
||||
self.restartTimeout = tonumber(t.restart_timeout)
|
||||
if t.attempts ~= nil then
|
||||
self.attempts = tonumber(t.attempts)
|
||||
end
|
||||
if t.attempt_interval ~= nil then
|
||||
self.attemptInterval = tonumber(t.attempt_interval)
|
||||
end
|
||||
if t.device_timeout ~= nil then
|
||||
self.deviceTimeout = tonumber(t.device_timeout)
|
||||
end
|
||||
if tonumber(t.disconnected_at_startup) == 1 then
|
||||
self._disconnectedAtStartup = true
|
||||
@@ -98,7 +102,7 @@ function Module:networkRestartFunc()
|
||||
self.name, table.concat(self._netDevices, ", ")))
|
||||
end
|
||||
self:netItemsDown()
|
||||
if self.restartTimeout < 1 then
|
||||
if self.deviceTimeout < 1 then
|
||||
self:netItemsUp()
|
||||
else
|
||||
self._ifaceRestarting = true
|
||||
@@ -115,7 +119,7 @@ end
|
||||
|
||||
function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
if self._ifaceRestarting then
|
||||
if self._ifaceRestartCounter >= self.restartTimeout then
|
||||
if self._ifaceRestartCounter >= self.deviceTimeout then
|
||||
self:netItemsUp()
|
||||
self._ifaceRestarting = false
|
||||
self._ifaceRestartCounter = 0
|
||||
@@ -124,24 +128,25 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
else
|
||||
if currentStatus == 1 then
|
||||
if not self._networkRestarted then
|
||||
if self._disconnectedAtStartup and (self.attempts == 0 or self._attemptsCounter < self.attempts) then
|
||||
if self._deadCounter >= self.deadPeriod then
|
||||
if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
|
||||
if self.attempts == 0 or self._attemptsCounter < self.attempts then
|
||||
if self._firstAttempt or self._attemptIntervalCounter >= self.attemptInterval then
|
||||
self:networkRestartFunc()
|
||||
self._networkRestarted = true
|
||||
self._deadCounter = 0
|
||||
self._attemptIntervalCounter = 0
|
||||
self._firstAttempt = false
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
self._attemptIntervalCounter = self._attemptIntervalCounter + timeDiff
|
||||
end
|
||||
end
|
||||
elseif inetChecked and (self.attempts == 0 or self._attemptsCounter < self.attempts) then
|
||||
self:networkRestartFunc()
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
end
|
||||
else
|
||||
self._attemptsCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._networkRestarted = false
|
||||
self._attemptsCounter = 0
|
||||
self._attemptIntervalCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._firstAttempt = true
|
||||
end
|
||||
self._ifaceRestartCounter = 0
|
||||
end
|
||||
|
||||
@@ -2,27 +2,31 @@
|
||||
local unistd = require("posix.unistd")
|
||||
|
||||
local Module = {
|
||||
name = "mod_user_scripts",
|
||||
runPrio = 80,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
deadPeriod = 0,
|
||||
alivePeriod = 0,
|
||||
upScript = "",
|
||||
downScript = "",
|
||||
upScriptAttempts = 1,
|
||||
downScriptAttempts = 1,
|
||||
status = nil,
|
||||
_deadCounter = 0,
|
||||
_aliveCounter = 0,
|
||||
_upScriptAttemptsCounter = 0,
|
||||
_downScriptAttemptsCounter = 0,
|
||||
_upScriptExecuted = false,
|
||||
_downScriptExecuted = false,
|
||||
_disconnectedAtStartup = false,
|
||||
_connectedAtStartup = false,
|
||||
name = "mod_user_scripts",
|
||||
runPrio = 80,
|
||||
config = {},
|
||||
syslog = function(level, msg) return true end,
|
||||
writeValue = function(filePath, str) return false end,
|
||||
readValue = function(filePath) return nil end,
|
||||
deadPeriod = 0,
|
||||
alivePeriod = 0,
|
||||
upScript = "",
|
||||
downScript = "",
|
||||
upScriptAttempts = 1,
|
||||
upScriptAttemptInterval = 15,
|
||||
downScriptAttempts = 1,
|
||||
downScriptAttemptInterval = 15,
|
||||
status = nil,
|
||||
_deadCounter = 0,
|
||||
_aliveCounter = 0,
|
||||
_upScriptAttemptsCounter = 0,
|
||||
_upScriptAttemptIntervalCounter = 0,
|
||||
_downScriptAttemptsCounter = 0,
|
||||
_downScriptAttemptIntervalCounter = 0,
|
||||
_upScriptFirstAttempt = true,
|
||||
_downScriptFirstAttempt = true,
|
||||
_disconnectedAtStartup = false,
|
||||
_connectedAtStartup = false,
|
||||
}
|
||||
|
||||
function Module:runExternalScript(scriptPath)
|
||||
@@ -41,9 +45,15 @@ function Module:init(t)
|
||||
if t.up_script_attempts ~= nil then
|
||||
self.upScriptAttempts = tonumber(t.up_script_attempts)
|
||||
end
|
||||
if t.up_script_attempt_interval ~= nil then
|
||||
self.upScriptAttemptInterval = tonumber(t.up_script_attempt_interval)
|
||||
end
|
||||
if t.down_script_attempts ~= nil then
|
||||
self.downScriptAttempts = tonumber(t.down_script_attempts)
|
||||
end
|
||||
if t.down_script_attempt_interval ~= nil then
|
||||
self.downScriptAttemptInterval = tonumber(t.down_script_attempt_interval)
|
||||
end
|
||||
if self.config.configDir then
|
||||
self.upScript = string.format(
|
||||
"%s/up-script.%s", self.config.configDir, self.config.serviceConfig.instance)
|
||||
@@ -74,41 +84,44 @@ end
|
||||
|
||||
function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
if currentStatus == 1 then
|
||||
self._upScriptAttemptsCounter = 0
|
||||
self._aliveCounter = 0
|
||||
self._connectedAtStartup = true
|
||||
self._upScriptExecuted = false
|
||||
if not self._downScriptExecuted then
|
||||
if self._disconnectedAtStartup and (self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts) then
|
||||
if self._deadCounter >= self.deadPeriod then
|
||||
self._upScriptAttemptsCounter = 0
|
||||
self._upScriptAttemptIntervalCounter = 0
|
||||
self._aliveCounter = 0
|
||||
self._connectedAtStartup = true
|
||||
self._upScriptFirstAttempt = true
|
||||
|
||||
if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
|
||||
if self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts then
|
||||
if self._downScriptFirstAttempt or self._downScriptAttemptIntervalCounter >= self.downScriptAttemptInterval then
|
||||
self:runDownScriptFunc()
|
||||
self._downScriptExecuted = true
|
||||
self._deadCounter = 0
|
||||
self._downScriptAttemptIntervalCounter = 0
|
||||
self._downScriptFirstAttempt = false
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
self._downScriptAttemptIntervalCounter = self._downScriptAttemptIntervalCounter + timeDiff
|
||||
end
|
||||
end
|
||||
|
||||
elseif inetChecked and (self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts) then
|
||||
self:runDownScriptFunc()
|
||||
else
|
||||
self._deadCounter = self._deadCounter + timeDiff
|
||||
end
|
||||
elseif currentStatus == 0 then
|
||||
self._downScriptAttemptsCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._downScriptExecuted = false
|
||||
if not self._upScriptExecuted then
|
||||
if self._connectedAtStartup and (self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts) then
|
||||
if self._aliveCounter >= self.alivePeriod then
|
||||
self._downScriptAttemptsCounter = 0
|
||||
self._downScriptAttemptIntervalCounter = 0
|
||||
self._deadCounter = 0
|
||||
self._disconnectedAtStartup = true
|
||||
self._downScriptFirstAttempt = true
|
||||
|
||||
if self._connectedAtStartup and self._aliveCounter >= self.alivePeriod then
|
||||
if self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts then
|
||||
if self._upScriptFirstAttempt or self._upScriptAttemptIntervalCounter >= self.upScriptAttemptInterval then
|
||||
self:runUpScriptFunc()
|
||||
self._upScriptExecuted = true
|
||||
self._aliveCounter = 0
|
||||
self._upScriptAttemptIntervalCounter = 0
|
||||
self._upScriptFirstAttempt = false
|
||||
else
|
||||
self._aliveCounter = self._aliveCounter + timeDiff
|
||||
self._upScriptAttemptIntervalCounter = self._upScriptAttemptIntervalCounter + timeDiff
|
||||
end
|
||||
end
|
||||
elseif inetChecked and (self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts) then
|
||||
self:runUpScriptFunc()
|
||||
else
|
||||
self._aliveCounter = self._aliveCounter + timeDiff
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-internet-detector
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=1
|
||||
LUCI_TITLE:=LuCI support for internet-detector
|
||||
LUCI_DEPENDS:=+internet-detector
|
||||
|
||||
@@ -56,6 +56,7 @@ document.head.append(E('style', {'type': 'text/css'},
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
`));
|
||||
|
||||
@@ -593,7 +594,7 @@ return view.extend({
|
||||
mode.default = '0';
|
||||
|
||||
|
||||
/* Service instances configuration */
|
||||
/* Instances configuration */
|
||||
|
||||
if(this.currentAppMode !== '2') {
|
||||
|
||||
@@ -608,7 +609,7 @@ return view.extend({
|
||||
|
||||
s = m.section(form.GridSection, 'instance');
|
||||
|
||||
s.title = _('Service instances');
|
||||
s.title = _('Instances');
|
||||
s.addremove = true;
|
||||
s.sortable = true;
|
||||
s.nodescriptions = true;
|
||||
@@ -830,11 +831,11 @@ return view.extend({
|
||||
|
||||
// Reboot device
|
||||
|
||||
o = s.taboption('reboot_device', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('Device will be rebooted when the Internet is disconnected.') +
|
||||
'</div>';
|
||||
o = s.taboption('reboot_device', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('Device will be rebooted when the Internet is disconnected.') +
|
||||
'</div>';
|
||||
o.modalonly = true;
|
||||
|
||||
// enabled
|
||||
@@ -921,10 +922,19 @@ return view.extend({
|
||||
o.value(0, _('infinitely'));
|
||||
o.default = '1';
|
||||
|
||||
// restart_timeout
|
||||
// attempt_interval
|
||||
o = s.taboption('restart_network', this.CBITimeInput,
|
||||
'mod_network_restart_attempt_interval', _('Attempt interval'),
|
||||
_('Interval between network restarts.')
|
||||
);
|
||||
o.default = '15';
|
||||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
// device_timeout
|
||||
o = s.taboption('restart_network', form.ListValue,
|
||||
'mod_network_restart_restart_timeout', _('Restart timeout'),
|
||||
_('Timeout between stopping and starting a network device.')
|
||||
'mod_network_restart_device_timeout', _('Device timeout'),
|
||||
_('Timeout between stopping and starting a network device when restarting.')
|
||||
);
|
||||
o.modalonly = true;
|
||||
o.value(0, '0 ' + _('sec'));
|
||||
@@ -998,6 +1008,15 @@ return view.extend({
|
||||
o.value(0, _('infinitely'));
|
||||
o.default = '1';
|
||||
|
||||
// attempt_interval
|
||||
o = s.taboption('restart_modem', this.CBITimeInput,
|
||||
'mod_modem_restart_attempt_interval', _('Attempt interval'),
|
||||
_('Interval between modem restarts.')
|
||||
);
|
||||
o.default = '15';
|
||||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
// iface
|
||||
o = s.taboption('restart_modem', widgets.NetworkSelect, 'mod_modem_restart_iface',
|
||||
_('Interface'),
|
||||
@@ -1010,7 +1029,7 @@ return view.extend({
|
||||
// iface_timeout
|
||||
o = s.taboption('restart_modem', form.ListValue,
|
||||
'mod_modem_restart_iface_timeout', _('Interface timeout'),
|
||||
_('Timeout between stopping and starting a ModemManger interface.')
|
||||
_('Timeout between stopping and starting a ModemManger interface when restarting.')
|
||||
);
|
||||
o.modalonly = true;
|
||||
o.value(0, '0 ' + _('sec'));
|
||||
@@ -1152,11 +1171,11 @@ return view.extend({
|
||||
|
||||
if(this.email) {
|
||||
if(this.emailExec) {
|
||||
o = s.taboption('email', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('An email will be sent when connected or disconnected from the Internet.') +
|
||||
'</div>';
|
||||
o = s.taboption('email', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('An email will be sent when connected or disconnected from the Internet.') +
|
||||
'</div>';
|
||||
o.modalonly = true;
|
||||
|
||||
// enabled
|
||||
@@ -1272,11 +1291,11 @@ return view.extend({
|
||||
|
||||
// User scripts
|
||||
|
||||
o = s.taboption('user_scripts', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('Shell commands to run when connected or disconnected from the Internet.') +
|
||||
'</div>';
|
||||
o = s.taboption('user_scripts', form.DummyValue, '_dummy');
|
||||
o.rawhtml = true;
|
||||
o.default = '<div class="cbi-section-descr">' +
|
||||
_('Shell commands to run when connected or disconnected from the Internet.') +
|
||||
'</div>';
|
||||
o.modalonly = true;
|
||||
|
||||
// enabled
|
||||
@@ -1318,6 +1337,15 @@ return view.extend({
|
||||
o.value(0, _('infinitely'));
|
||||
o.default = '1';
|
||||
|
||||
// up_script_attempt_interval
|
||||
o = s.taboption('user_scripts', this.CBITimeInput,
|
||||
'mod_user_scripts_up_script_attempt_interval', _('up_script attempt interval'),
|
||||
_('Interval between up-script runs.')
|
||||
);
|
||||
o.default = '15';
|
||||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
// connected_at_startup
|
||||
o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_connected_at_startup',
|
||||
_('On startup'),
|
||||
@@ -1359,6 +1387,15 @@ return view.extend({
|
||||
o.value(0, _('infinitely'));
|
||||
o.default = '1';
|
||||
|
||||
// down_script_attempt_interval
|
||||
o = s.taboption('user_scripts', this.CBITimeInput,
|
||||
'mod_user_scripts_down_script_attempt_interval', _('down-script attempt interval'),
|
||||
_('Interval between down-script runs.')
|
||||
);
|
||||
o.default = '15';
|
||||
o.rmempty = false;
|
||||
o.modalonly = true;
|
||||
|
||||
// disconnected_at_startup
|
||||
o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_disconnected_at_startup',
|
||||
_('On startup'),
|
||||
|
||||
@@ -51,14 +51,15 @@ document.head.append(E('style', {'type': 'text/css'},
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
`));
|
||||
|
||||
return baseclass.extend({
|
||||
title : _('Internet'),
|
||||
appName : 'internet-detector',
|
||||
currentAppMode : null,
|
||||
inetStatus : null,
|
||||
title : _('Internet'),
|
||||
appName : 'internet-detector',
|
||||
currentAppMode : null,
|
||||
inetStatus : null,
|
||||
|
||||
callUIPoll: rpc.declare({
|
||||
object: 'luci.internet-detector',
|
||||
|
||||
@@ -44,6 +44,9 @@ msgstr "Сообщение будет отправлено при подключ
|
||||
msgid "An error has occurred"
|
||||
msgstr "Произошла ошибка"
|
||||
|
||||
msgid "Attempt interval"
|
||||
msgstr "Интервал попыток"
|
||||
|
||||
msgid "Attempts"
|
||||
msgstr "Попытки"
|
||||
|
||||
@@ -198,6 +201,9 @@ msgstr "Запрос ICMP-echo (ping)"
|
||||
msgid "ICMP packet data size"
|
||||
msgstr "Размер данных ICMP-пакета"
|
||||
|
||||
msgid "Instances"
|
||||
msgstr "Экземпляры"
|
||||
|
||||
msgid "Interface"
|
||||
msgstr "Интерфейс"
|
||||
|
||||
@@ -222,6 +228,18 @@ msgstr "Интервал между запросами IP адреса."
|
||||
msgid "Interval between IP address requests if the IP address is not defined."
|
||||
msgstr "Интервал между запросами IP адреса, если IP адрес не определён."
|
||||
|
||||
msgid "Interval between modem restarts."
|
||||
msgstr "Интервал между перезапусками модема."
|
||||
|
||||
msgid "Interval between network restarts."
|
||||
msgstr "Интервал между перезапусками сети."
|
||||
|
||||
msgid "Interval between down-script runs."
|
||||
msgstr "Интервал между запусками down-script."
|
||||
|
||||
msgid "Interval between up-script runs."
|
||||
msgstr "Интервал между запусками up-script."
|
||||
|
||||
msgid "Jumbo: 9000 bytes"
|
||||
msgstr "Гигантский: 9000 байт"
|
||||
|
||||
@@ -391,8 +409,8 @@ msgstr "Перезапуск сети если Интренет отключен
|
||||
msgid "Restart service"
|
||||
msgstr "Перезапуск службы"
|
||||
|
||||
msgid "Restart timeout"
|
||||
msgstr "Таймаут перезапуска"
|
||||
msgid "Device timeout"
|
||||
msgstr "Таймаут устройства"
|
||||
|
||||
msgid "Run interval"
|
||||
msgstr "Интервал запуска"
|
||||
@@ -451,9 +469,6 @@ msgstr "Сервис для определения публичного IP ад
|
||||
msgid "Service: detector always runs as a system service."
|
||||
msgstr "Служба: детектор работает постоянно, как системная служба."
|
||||
|
||||
msgid "Service instances"
|
||||
msgstr "Экземпляры службы"
|
||||
|
||||
msgid "Set the modem to be allowed to use any band."
|
||||
msgstr "Разрешить модему использование любой частоты."
|
||||
|
||||
@@ -496,11 +511,11 @@ msgstr "Тип записи запрашиваемой в DNS-запросе (е
|
||||
msgid "TLS: use STARTTLS if the server supports it."
|
||||
msgstr "TLS: использовать STARTTLS если сервер поддерживает."
|
||||
|
||||
msgid "Timeout between stopping and starting a network device."
|
||||
msgstr "Таймаут между остановкой и запуском сетевого устройства."
|
||||
msgid "Timeout between stopping and starting a network device when restarting."
|
||||
msgstr "Таймаут между остановкой и запуском сетевого устройства при перезапуске."
|
||||
|
||||
msgid "Timeout between stopping and starting a ModemManger interface."
|
||||
msgstr "Таймаут между остановкой и запуском интерфейса ModemManger."
|
||||
msgid "Timeout between stopping and starting a ModemManger interface when restarting."
|
||||
msgstr "Таймаут между остановкой и запуском интерфейса ModemManger при перезапуске."
|
||||
|
||||
msgid "Type a time string"
|
||||
msgstr "Введите строку времени"
|
||||
@@ -599,5 +614,11 @@ msgstr "up-script"
|
||||
msgid "down-script attempts"
|
||||
msgstr "Попытки down-script"
|
||||
|
||||
msgid "down-script attempt interval"
|
||||
msgstr "Интервал попыток down-script"
|
||||
|
||||
msgid "up-script attempts"
|
||||
msgstr "Попытки up-script"
|
||||
|
||||
msgid "up_script attempt interval"
|
||||
msgstr "Интервал попыток up_script"
|
||||
|
||||
@@ -32,6 +32,9 @@ msgstr ""
|
||||
msgid "An error has occurred"
|
||||
msgstr ""
|
||||
|
||||
msgid "Attempt interval"
|
||||
msgstr ""
|
||||
|
||||
msgid "Attempts"
|
||||
msgstr ""
|
||||
|
||||
@@ -184,6 +187,9 @@ msgstr ""
|
||||
msgid "ICMP packet data size"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
msgid "Interface"
|
||||
msgstr ""
|
||||
|
||||
@@ -208,6 +214,18 @@ msgstr ""
|
||||
msgid "Interval between IP address requests if the IP address is not defined."
|
||||
msgstr ""
|
||||
|
||||
msgid "Interval between modem restarts."
|
||||
msgstr ""
|
||||
|
||||
msgid "Interval between network restarts."
|
||||
msgstr ""
|
||||
|
||||
msgid "Interval between down-script runs."
|
||||
msgstr ""
|
||||
|
||||
msgid "Interval between up-script runs."
|
||||
msgstr ""
|
||||
|
||||
msgid "Jumbo: 9000 bytes"
|
||||
msgstr ""
|
||||
|
||||
@@ -363,7 +381,7 @@ msgstr ""
|
||||
msgid "Restart service"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restart timeout"
|
||||
msgid "Device timeout"
|
||||
msgstr ""
|
||||
|
||||
msgid "Run interval"
|
||||
@@ -423,9 +441,6 @@ msgstr ""
|
||||
msgid "Service: detector always runs as a system service."
|
||||
msgstr ""
|
||||
|
||||
msgid "Service instances"
|
||||
msgstr ""
|
||||
|
||||
msgid "Set the modem to be allowed to use any band."
|
||||
msgstr ""
|
||||
|
||||
@@ -468,10 +483,10 @@ msgstr ""
|
||||
msgid "TLS: use STARTTLS if the server supports it."
|
||||
msgstr ""
|
||||
|
||||
msgid "Timeout between stopping and starting a network device."
|
||||
msgid "Timeout between stopping and starting a network device when restarting."
|
||||
msgstr ""
|
||||
|
||||
msgid "Timeout between stopping and starting a ModemManger interface."
|
||||
msgid "Timeout between stopping and starting a ModemManger interface when restarting."
|
||||
msgstr ""
|
||||
|
||||
msgid "Type a time string"
|
||||
@@ -564,5 +579,11 @@ msgstr ""
|
||||
msgid "down-script attempts"
|
||||
msgstr ""
|
||||
|
||||
msgid "down-script attempt interval"
|
||||
msgstr ""
|
||||
|
||||
msgid "up-script attempts"
|
||||
msgstr ""
|
||||
|
||||
msgid "up_script attempt interval"
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user