From 26a72bf1519a8933e3fabc884a024e72947008e0 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Tue, 6 May 2008 07:45:08 +0000 Subject: Changing start/stop/restart process to show stderr to the user (as for all other ACF's) git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@1103 ab2d0c66-481e-0410-8bed-d214d4d58bed --- squid-model.lua | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'squid-model.lua') diff --git a/squid-model.lua b/squid-model.lua index e2b9285..f23f026 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -6,6 +6,7 @@ module (..., package.seeall) require("format") require("processinfo") require("procps") +require("daemoncontrol") -- Set variables local squidconf = "/etc/squid/squid.conf" @@ -121,24 +122,12 @@ get_status_winbindd = function() return retval end -service_control = function( control ) - - local retval = "" - - local ptr = io.popen( "/etc/init.d/squid " .. control, "r" ) - if ptr ~= nil then - local retmsg = ptr:read( "*a" ) - ptr:close() - if retmsg ~= nil then - retval = retmsg - else - retval = "service_control(): Failed to read output from initscript!\n" - end - else - retval = "service_control(): Failed to start/stop/restart service!\n" - end - - return retval +service_control = function( cmd ) + local action = {value=cmd} + local cmdresult,cmdmessage,cmderror,cmdaction = daemoncontrol.daemoncontrol(processname, cmd) + action.descr=cmdmessage + action.errtxt=cmderror + return cmdresult,action end service_control_winbindd = function( control ) -- cgit v1.2.3