diff options
-rw-r--r-- | dhcp-model.lua | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/dhcp-model.lua b/dhcp-model.lua index 04186f5..9709e0a 100644 --- a/dhcp-model.lua +++ b/dhcp-model.lua @@ -5,6 +5,7 @@ module (..., package.seeall) --- get additional libraries require("procps") require("validator") +require("daemoncontrol") local subnet = {} local cfgdir = "/etc/dhcp/" @@ -783,17 +784,12 @@ end service_control = function ( command ) local retval = "" - local line = "" - local file = io.popen( "/etc/init.d/dhcpd " .. command .. " 2>&1" ) - if file ~= nil then - line = file:read( "*l" ) - while line ~= nil do - retval = retval .. "\n" .. line - line = file:read( "*l" ) - end - file:close() - end - + local code = false + local x + local y + + code, retval, x, y = daemoncontrol.daemoncontrol ( "dhcpd", command ) + return retval end |