summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-01-31 20:53:49 +0000
committerMika Havela <mika.havela@gmail.com>2008-01-31 20:53:49 +0000
commitf41e6f501d5d246d1190fcca46d3c11526031cf8 (patch)
tree3603f1d1f39650efb970ab47e1e4ab762d7cf746 /lib
parent37323aa70abc9aabe29c561d4d9f08807255b3e8 (diff)
downloadacf-core-f41e6f501d5d246d1190fcca46d3c11526031cf8.tar.bz2
acf-core-f41e6f501d5d246d1190fcca46d3c11526031cf8.tar.xz
Chaing how the daemoncontrol reports back status
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@671 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib')
-rw-r--r--lib/daemoncontrol.lua15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/daemoncontrol.lua b/lib/daemoncontrol.lua
index 838b039..9a13046 100644
--- a/lib/daemoncontrol.lua
+++ b/lib/daemoncontrol.lua
@@ -2,20 +2,17 @@ module (..., package.seeall)
require("posix")
function daemoncontrol (process, action)
- local cmdresult = ""
+ local cmdmessage = ""
if (string.lower(action) == "start") or (string.lower(action) == "stop") or (string.lower(action) == "restart") then
- local file = io.popen( "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin /etc/init.d/" .. process .. " " .. action .. " 2>&1" )
+ local file = io.popen( "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin /etc/init.d/" ..
+ process .. " " .. action .. " 2>&1" )
if file ~= nil then
- line = file:read( "*l" )
- while line ~= nil do
- cmdresult = cmdresult .. "\n" .. line
- line = file:read( "*l" )
- end
+ cmdmessage = file:read( "*a" )
file:close()
end
else
- cmdresult = "Unknown command!"
+ cmderror = "Unknown command!"
end
posix.sleep(2) -- Wait for the process to start|stop
- return {cmdresult=cmdresult, process=process, action=action,cmderror=cmderror }
+ return true, action,cmdmessage,cmderror
end