From 3de1e9f3880e7be975350c29507e69d6b504a1db Mon Sep 17 00:00:00 2001 From: chas-iot Date: Sat, 20 Nov 2021 15:49:43 +0800 Subject: [PATCH] logging changes --- usr/sbin/wanmonitor.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/usr/sbin/wanmonitor.lua b/usr/sbin/wanmonitor.lua index 016472c..b0a5ae0 100644 --- a/usr/sbin/wanmonitor.lua +++ b/usr/sbin/wanmonitor.lua @@ -766,12 +766,19 @@ local function initialise() pidFile = "/var/run/wanmonitor." .. interface .. ".pid" local config = uciGet("wanmonitor", interface) - if not config or not toboolean(config.enabled) then + if not config then + log("LOG_ERR", "No config found for interface " .. interface) + os.exit() + end + + if not toboolean(config.enabled) then + log("LOG_ERR", "The config for " .. interface .. " is not enabled") os.exit() end local status = interfaceStatus(interface) if not status.up then + log("LOG_ERR", "The interface " .. interface .." is not up") os.exit() end device = status.l3_device @@ -878,7 +885,7 @@ local function initialise() if type(logfileArg) == "string" and string.find(logfileArg, "^/[^%$]*$") then logfile = logfileArg else - log("LOG_ERR", "Invalid log arguement path") + log("LOG_ERR", "Invalid log argument path") os.exit() end elseif config.logfile then