diff options
author | Ted Trask <ttrask01@yahoo.com> | 2012-04-18 16:33:11 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2012-04-18 16:33:11 +0000 |
commit | aa8f6a9bb719259c5d557ebbf0d1cf4ef79f0a2f (patch) | |
tree | 35de3361d1c27e27c37cc2036db976ef84ae92ec /fetchmail-model.lua | |
parent | 80f25c722a6ad2a9fe3932a6a7a1aa63169ddf33 (diff) | |
download | acf-fetchmail-aa8f6a9bb719259c5d557ebbf0d1cf4ef79f0a2f.tar.bz2 acf-fetchmail-aa8f6a9bb719259c5d557ebbf0d1cf4ef79f0a2f.tar.xz |
Fixed startstop to match new method
Diffstat (limited to 'fetchmail-model.lua')
-rw-r--r-- | fetchmail-model.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fetchmail-model.lua b/fetchmail-model.lua index fbd63ad..16992d1 100644 --- a/fetchmail-model.lua +++ b/fetchmail-model.lua @@ -388,12 +388,13 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function startstop_service(action) - local result = modelfunctions.startstop_service(processname, action) - table.insert(result.value.actions.value, "Run") - table.insert(result.value.actions.value, "Test") +function get_startstop(clientdata) + local actions = {"Run", "Test"} + return cfe({ type="group", label="Management", value={}, option=actions }) +end + +function startstop_service(startstop, action) if action and (action:lower() == "run" or action:lower() == "test") then - result.value.result.errtxt = nil local cmd if action:lower() == "run" then cmd = 'su -s /bin/sh -c "/usr/bin/fetchmail -d0 -v --nosyslog -f '..configfile..' 2>&1" - fetchmail' @@ -401,10 +402,12 @@ function startstop_service(action) cmd = 'su -s /bin/sh -c "/usr/bin/fetchmail -d0 -v -k --nosyslog -f '..configfile..' 2>&1" - fetchmail' end local f = io.popen(cmd) - result.value.result.value = f:read("*a") + startstop.descr = f:read("*a") f:close() + else + startstop.errtxt = "Invalid action" end - return result + return startstop end function getstatus() |