diff options
Diffstat (limited to 'syslog-controller.lua')
-rw-r--r-- | syslog-controller.lua | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/syslog-controller.lua b/syslog-controller.lua index 76089fb..8869fec 100644 --- a/syslog-controller.lua +++ b/syslog-controller.lua @@ -1,41 +1,30 @@ - module(..., package.seeall) ---require("privsep") -require("join") - --- those should go into acf.conf -local user="nobody" -local group="nobody" - --- drop privileges and put privileged model funcs in self.priv mvc = {} function mvc.on_load(self) --- self.priv = privsep.drop_privs(user, group, self.model.priv) end function status(self) + return self.model.getstatus() end + function config(self) - local ctl = {} - local opts = self.model.readopts() --- ctl.pidlist = self.priv.is_enabled() - if pidlist then - ctl.status = "enabled" - else - ctl.status = "Disabled" + local srvcmdresult = nil + local srvcmd = self.clientdata.srvcmd + if (srvcmd ~= nil) then + srvcmdresult = self.model:service_control(srvcmd) + if (srvcmd == "stop") or (srvcmd == "restart") then + posix.sleep(3) -- Wait for the process to start|stop + else + posix.sleep(1) -- Wait for the process to start|stop + end end - ctl.opts = opts - if opts and opts.remote then - ctl.remote = "checked" - ctl.host = opts.remote - else - ctl.remote = "" - ctl.host = "" - end - return ctl + + return { status = self.model.getstatus(), srvcmdresult=srvcmdresult, config= self.model.getconfig() } end + function expert(self) + return {status="Work in progress!"} end |