summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-01-16 21:58:03 +0000
committerTed Trask <ttrask01@yahoo.com>2012-01-16 21:58:03 +0000
commitb4d98246f8f50fd185ca6c141ee1564c5a8e3c26 (patch)
tree0a0e56f2ccd3ae57c75cf5fa109b6a93b9b18c65
parent24244ddb59ea8e4b4d16c71da48e4c1ec3ee5ef2 (diff)
downloadacf-lib-b4d98246f8f50fd185ca6c141ee1564c5a8e3c26.tar.bz2
acf-lib-b4d98246f8f50fd185ca6c141ee1564c5a8e3c26.tar.xz
Added new daemon_actions function to processinfo
-rw-r--r--processinfo.lua17
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