diff options
author | psyborg55 <psyborg55@users.noreply.github.com> | 2017-04-14 23:30:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-14 23:30:47 +0200 |
commit | d912d6bb4740322da290d1ecd19225d413b2ae9a (patch) | |
tree | 397b160462d911919dc69b7e7f89cb25b13670cb | |
parent | a82ca22ffcaf43ea9c0e64d7ccc538777f8d962e (diff) |
luci-app-mwan3: disable uci/sed errors print to syslog
Maintainer: @arfett
Compile tested: ramips, xiaomi mini, r50082
Run tested: ramips, xiaomi mini, r50082
Add uci parameter to silence errors printed to syslog and append extra redirect of sed error messages to /dev/null.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-rw-r--r-- | applications/luci-app-mwan3/luasrc/controller/mwan3.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index 3d5a23dd0..d3fd15069 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -64,9 +64,9 @@ function index() end function getInterfaceStatus(ruleNumber, interfaceName) - if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then + if ut.trim(sys.exec("uci -q -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then if ut.trim(sys.exec(ip .. "route list table " .. ruleNumber)) ~= "" then - if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then + if ut.trim(sys.exec("uci -q -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then return "online" else return "notMonitored" @@ -102,7 +102,7 @@ function interfaceStatus() wansid = {} for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do - local wanInterfaceName = ut.trim(sys.exec("uci -p /var/state get network." .. wanName .. ".ifname")) + local wanInterfaceName = ut.trim(sys.exec("uci -q -p /var/state get network." .. wanName .. ".ifname")) if wanInterfaceName == "" then wanInterfaceName = "X" end @@ -115,7 +115,7 @@ function interfaceStatus() end -- overview status log - local mwanLog = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x'")) + local mwanLog = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x' 2>/dev/null")) if mwanLog ~= "" then mArray.mwanlog = { mwanLog } end @@ -163,7 +163,7 @@ function diagnosticsData(interface, tool, task) results = "MWAN3 started" end else - local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interface .. ".ifname")) + local interfaceDevice = ut.trim(sys.exec("uci -q -p /var/state get network." .. interface .. ".ifname")) if interfaceDevice ~= "" then if tool == "ping" then local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'")) @@ -172,7 +172,7 @@ function diagnosticsData(interface, tool, task) local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway results = pingCommand .. "\n\n" .. sys.exec(pingCommand) else - local tracked = ut.trim(sys.exec("uci -p /var/state get mwan3." .. interface .. ".track_ip")) + local tracked = ut.trim(sys.exec("uci -q -p /var/state get mwan3." .. interface .. ".track_ip")) if tracked ~= "" then for z in tracked:gmatch("[^ ]+") do local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z @@ -301,7 +301,7 @@ function troubleshootingData() mArray.iprule = { ipRuleShow } -- ip route list table 1-250 - local routeList, routeString = ut.trim(sys.exec(ip .. "rule | sed 's/://g' | awk '$1>=2001 && $1<=2250' | awk '{print $NF}'")), "" + local routeList, routeString = ut.trim(sys.exec(ip .. "rule | sed 's/://g' 2>/dev/null | awk '$1>=2001 && $1<=2250' | awk '{print $NF}'")), "" if routeList ~= "" then for line in routeList:gmatch("[^\r\n]+") do routeString = routeString .. line .. "\n" .. sys.exec(ip .. "route list table " .. line) @@ -313,7 +313,7 @@ function troubleshootingData() mArray.routelist = { routeString } -- default firewall output policy - local firewallOut = ut.trim(sys.exec("uci -p /var/state get firewall.@defaults[0].output")) + local firewallOut = ut.trim(sys.exec("uci -q -p /var/state get firewall.@defaults[0].output")) if firewallOut == "" then firewallOut = "No data found" end |