From 35163d653d56ee868d6b520c899aa04104537e26 Mon Sep 17 00:00:00 2001 From: Andreas Brodmann Date: Wed, 5 Mar 2008 10:32:31 +0000 Subject: migrated service control to mhavela's daemoncontrol git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@815 ab2d0c66-481e-0410-8bed-d214d4d58bed --- dhcp-model.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'dhcp-model.lua') 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 -- cgit v1.2.3