Minor fixes

This commit is contained in:
gSpot
2021-12-20 19:37:58 +03:00
parent ab0a2bce86
commit 80845f6c3d

View File

@@ -67,7 +67,8 @@ end
-- Loading settings from UCI
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.checkType = tonumber(uciCursor:get(
Config.appName, "config", "check_type"))
@@ -263,7 +264,7 @@ local function status()
end
local function poll(attempts, timeout)
if Config.mode == "1" then
if Config.mode == 1 then
Config.connectionAttempts = Config.UIConnectionAttempts
Config.connectionTimeout = Config.UIConnectionTimeout
end
@@ -287,7 +288,7 @@ local function inetStatus()
if inetStatVal ~= nil and tonumber(inetStatVal) == 0 then
inetStat = "up"
end
elseif Config.mode == "1" then
elseif Config.mode == 1 then
inetStat = poll()
else
os.exit(126)
@@ -324,9 +325,9 @@ local function stop()
end
local function preRun()
-- Exit if internet-detector mode != 2(Service)
if Config.mode ~= "2" then
io.stderr:write(string.format('Start failed, mode != "2"\n', Config.appName))
-- Exit if internet detector mode != 2(Service)
if Config.mode ~= 2 then
io.stderr:write(string.format('Start failed, mode != 2\n', Config.appName))
os.exit(0)
end
if nixio.fs.access(Config.pidFile, "r") then