diff options
-rw-r--r-- | processinfo.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/processinfo.lua b/processinfo.lua index 3cc1b96..0adb3f4 100644 --- a/processinfo.lua +++ b/processinfo.lua @@ -109,7 +109,6 @@ function delete_runlevels(servicename, runlevels) end function daemoncontrol (process, action) - local cmdresult = "" local cmderrors if not process then @@ -127,6 +126,22 @@ function daemoncontrol (process, action) return cmdresult,cmderrors end +function daemon_actions (process) + local actions = {"start", "stop", "restart", "describe", "zap"} + local description + local res, err = daemoncontrol(process, "describe") + if err then + return nil, err + else + lines = format.string_to_table(res, "\n") + description = string.match(lines[1], "^%s*%*%s*(.*)") + for i=2,#lines,1 do + actions[#actions+1] = string.match(lines[i], "^%s*%*%s*(%w*)") + end + end + return actions, description +end + -- the following methods are available: -- /proc/<pid>/stat the comm field (2nd) field contains name but only up -- to 15 chars. does not resolve links |