summaryrefslogtreecommitdiffstats
path: root/asterisk-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'asterisk-model.lua')
-rw-r--r--asterisk-model.lua16
1 files changed, 1 insertions, 15 deletions
diff --git a/asterisk-model.lua b/asterisk-model.lua
index 297656e..4aa9f6e 100644
--- a/asterisk-model.lua
+++ b/asterisk-model.lua
@@ -28,22 +28,8 @@ get_status = function()
return modelfunctions.getstatus(processname, packagename, "Asterisk Status")
end
--- local implementation to add reload actions
function startstop_service(action)
- local cmdresult = cfe({ label="Start/Stop result" })
-
- if (string.lower(action) == "start") or (string.lower(action) == "stop") or (string.lower(action) == "restart") or (string.lower(action) == "reload") then
- local file = io.popen( "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin /etc/init.d/" ..
- processname .. " " .. string.lower(action) .. " 2>&1" )
- if file ~= nil then
- cmdresult.value = file:read( "*a" )
- file:close()
- end
- posix.sleep(2) -- Wait for the process to start|stop
- else
- cmdresult.errtxt = "Unknown command!"
- end
- return cmdresult
+ return modelfunctions.startstop_service(processname, action, {"start", "stop", "restart", "reload"})
end
get_file = function(filename)