From fa9fd27d3c09519aca6a3ad35f17008d211f24b1 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Jun 2009 16:02:21 +0000 Subject: Updated for startstop in core 0.5.0 --- postfix-controller.lua | 2 +- postfix-model.lua | 30 ++---------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/postfix-controller.lua b/postfix-controller.lua index 0967ddd..4ea0f76 100644 --- a/postfix-controller.lua +++ b/postfix-controller.lua @@ -10,7 +10,7 @@ function status(self) end function startstop(self) - return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata) + return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata) end function details(self) diff --git a/postfix-model.lua b/postfix-model.lua index 8dd92c6..639ede1 100644 --- a/postfix-model.lua +++ b/postfix-model.lua @@ -37,37 +37,11 @@ end -- PUBLIC FUNCTIONS function startstop_service(action) - return modelfunctions.startstop_service(processname, action, {"start", "stop", "restart", "reload"}) + return modelfunctions.startstop_service(processname, action, {"Start", "Stop", "Restart", "Reload"}) end function getstatus() - local status = modelfunctions.getstatus(processname, packagename, "Postfix Status") - - -- Enabled status is unique for postfix - -- Look for pid file stored in queue_directory .. /pid/ - local config = getconfig() - if config.queue_directory then - local pidfiles = fs.find_files_as_array(".*\.pid", config.queue_directory.."/pid/") - if pidfiles and pidfiles[1] then - local file = pidfiles[1] - -- check to see if there's a matching proc directory and that it was created slightly after the pid file - -- this allows us to avoid the problem with proc numbers wrapping - local tmp = string.match(fs.read_file(file) or "", "%d+") - if tmp then - local dir = "/proc/" .. tmp - -- postfix seems to have a problem with changing times? - --[[ filetime = posix.stat(file, "ctime") - dirtime = posix.stat(dir, "ctime") - if dirtime and (tonumber(dirtime) - tonumber(filetime) < 100) then - --]] - if posix.stat(dir.."/cmdline") and string.find(fs.read_file(dir.."/cmdline"), processname) then - status.value.status.value = "Running" - end - end - end - end - - return status + return modelfunctions.getstatus(processname, packagename, "Postfix Status") end function getstatusdetails() -- cgit v1.2.3