diff options
Diffstat (limited to 'rc-model.lua')
-rw-r--r-- | rc-model.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/rc-model.lua b/rc-model.lua index c213e1f..215d02d 100644 --- a/rc-model.lua +++ b/rc-model.lua @@ -17,7 +17,16 @@ table.sort(runlevels) local config status = function() - config = config or processinfo.read_initrunlevels() + if not config then + config = processinfo.read_initrunlevels() + for i,c in pairs(config) do + c.actions, c.description = processinfo.daemon_actions(c.servicename) + c.status = processinfo.daemoncontrol(c.servicename, "status") + if c.status then + c.status = string.match(c.status, "status: (.*)") + end + end + end return cfe({ type="structure", value=config, label="Init Runlevels" }) end @@ -73,3 +82,20 @@ update_runlevels = function(service) return service end + +handle_startstop = function(servicename, action) + local result = "" + local errtxt + local actions,errtxt = processinfo.daemon_actions(servicename) + if actions then + errtxt = nil + local reverseactions = {} + for i,act in ipairs(actions) do reverseactions[string.lower(act)] = i end + if reverseactions[string.lower(action)] then + result, errtxt = processinfo.daemoncontrol(servicename, action) + else + errtxt = "Unknown command!" + end + end + return cfe({ label="Start/Stop result", value=result, errtxt=errtxt }) +end |