Merge pull request #1735 from sumpfralle/olsr-jsoninfo-parser-handle-empty-result
[oweals/luci.git] / modules / luci-base / luasrc / sys.lua
index bb4c67fe88319a1d93afb2394f8e8a59533bc04a..5aede84848edbe875079d3fabe3e908329a58278 100644 (file)
@@ -189,7 +189,7 @@ local function _nethints(what, callback)
                        end
                end
        )
-       
+
        cur:foreach("dhcp", "odhcpd",
                function(s)
                        if type(s.leasefile) == "string" and fs.access(s.leasefile) then
@@ -443,11 +443,11 @@ function process.list()
 
        for line in ps do
                local pid, ppid, user, stat, vsz, mem, cpu, cmd = line:match(
-                       "^ *(%d+) +(%d+) +(%S.-%S) +([RSDZTW][W ][<N ]) +(%d+) +(%d+%%) +(%d+%%) +(.+)"
+                       "^ *(%d+) +(%d+) +(%S.-%S) +([RSDZTW][<NW ][<N ]) +(%d+) +(%d+%%) +(%d+%%) +(.+)"
                )
 
                local idx = tonumber(pid)
-               if idx then
+               if idx and not cmd:match("top %-bn1") then
                        data[idx] = {
                                ['PID']     = pid,
                                ['PPID']    = ppid,
@@ -645,7 +645,7 @@ function init.enabled(name)
 end
 
 function init.enable(name)
-       return (init_action("enable", name) == 1)
+       return (init_action("enable", name) == 0)
 end
 
 function init.disable(name)
@@ -659,3 +659,11 @@ end
 function init.stop(name)
        return (init_action("stop", name) == 0)
 end
+
+function init.restart(name)
+       return (init_action("restart", name) == 0)
+end
+
+function init.reload(name)
+       return (init_action("reload", name) == 0)
+end