mirror of
https://github.com/gSpotx2f/luci-app-internet-detector.git
synced 2025-12-07 12:06:54 +03:00
Minor fixes
This commit is contained in:
@@ -67,7 +67,8 @@ end
|
|||||||
-- Loading settings from UCI
|
-- Loading settings from UCI
|
||||||
|
|
||||||
local uciCursor = uci.cursor()
|
local uciCursor = uci.cursor()
|
||||||
Config.mode = uciCursor:get(Config.appName, "config", "mode")
|
Config.mode = tonumber(uciCursor:get(
|
||||||
|
Config.appName, "config", "mode"))
|
||||||
Config.hosts = uciCursor:get(Config.appName, "config", "hosts")
|
Config.hosts = uciCursor:get(Config.appName, "config", "hosts")
|
||||||
Config.checkType = tonumber(uciCursor:get(
|
Config.checkType = tonumber(uciCursor:get(
|
||||||
Config.appName, "config", "check_type"))
|
Config.appName, "config", "check_type"))
|
||||||
@@ -263,7 +264,7 @@ local function status()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function poll(attempts, timeout)
|
local function poll(attempts, timeout)
|
||||||
if Config.mode == "1" then
|
if Config.mode == 1 then
|
||||||
Config.connectionAttempts = Config.UIConnectionAttempts
|
Config.connectionAttempts = Config.UIConnectionAttempts
|
||||||
Config.connectionTimeout = Config.UIConnectionTimeout
|
Config.connectionTimeout = Config.UIConnectionTimeout
|
||||||
end
|
end
|
||||||
@@ -287,7 +288,7 @@ local function inetStatus()
|
|||||||
if inetStatVal ~= nil and tonumber(inetStatVal) == 0 then
|
if inetStatVal ~= nil and tonumber(inetStatVal) == 0 then
|
||||||
inetStat = "up"
|
inetStat = "up"
|
||||||
end
|
end
|
||||||
elseif Config.mode == "1" then
|
elseif Config.mode == 1 then
|
||||||
inetStat = poll()
|
inetStat = poll()
|
||||||
else
|
else
|
||||||
os.exit(126)
|
os.exit(126)
|
||||||
@@ -324,9 +325,9 @@ local function stop()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function preRun()
|
local function preRun()
|
||||||
-- Exit if internet-detector mode != 2(Service)
|
-- Exit if internet detector mode != 2(Service)
|
||||||
if Config.mode ~= "2" then
|
if Config.mode ~= 2 then
|
||||||
io.stderr:write(string.format('Start failed, mode != "2"\n', Config.appName))
|
io.stderr:write(string.format('Start failed, mode != 2\n', Config.appName))
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
end
|
end
|
||||||
if nixio.fs.access(Config.pidFile, "r") then
|
if nixio.fs.access(Config.pidFile, "r") then
|
||||||
|
|||||||
Reference in New Issue
Block a user