summaryrefslogtreecommitdiffstats
path: root/postfix-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-12-31 15:49:13 +0000
committerTed Trask <ttrask01@yahoo.com>2008-12-31 15:49:13 +0000
commit693030035ed1152f8ec7144a622e9122c373c026 (patch)
tree01bcee7809da8ef5d874e36df96fea6bf474d25f /postfix-model.lua
downloadacf-postfix-693030035ed1152f8ec7144a622e9122c373c026.tar.bz2
acf-postfix-693030035ed1152f8ec7144a622e9122c373c026.tar.xz
Added postfix controller with basic functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/postfix/trunk@1655 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'postfix-model.lua')
-rw-r--r--postfix-model.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/postfix-model.lua b/postfix-model.lua
new file mode 100644
index 0000000..87e6a00
--- /dev/null
+++ b/postfix-model.lua
@@ -0,0 +1,53 @@
+module(..., package.seeall)
+
+-- Load libraries
+require("modelfunctions")
+require("fs")
+require("format")
+
+-- Set variables
+local processname = "postfix"
+local packagename = "postfix"
+local baseurl = "/etc/postfix/"
+local filelist = {baseurl.."main.cf", baseurl.."master.cf", baseurl.."saslpass"}
+
+local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
+
+-- ################################################################################
+-- LOCAL FUNCTIONS
+
+-- ################################################################################
+-- PUBLIC FUNCTIONS
+
+function startstop_service(action)
+ return modelfunctions.startstop_service(processname, action)
+end
+
+function getstatus()
+ return modelfunctions.getstatus(processname, packagename, "Postfix Status")
+end
+
+function getstatusdetails()
+ return cfe({ type="longtext", value="", label="Postfix Status Details" })
+end
+
+function getfilelist()
+ local listed_files = {}
+
+ for i,name in ipairs(filelist) do
+ local filedetails = fs.stat(name)
+ table.insert ( listed_files , {filename=name, mtime=filedetails.mtime, filesize=filedetails.size} )
+ end
+
+ table.sort(listed_files, function (a,b) return (a.filename < b.filename) end )
+
+ return cfe({ type="list", value=listed_files, label="Postfix File List" })
+end
+
+function getfiledetails(filename)
+ return modelfunctions.getfiledetails(filename, filelist)
+end
+
+function updatefiledetails(filedetails)
+ return modelfunctions.setfiledetails(filedetails, filelist)
+end