diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-05-06 07:45:08 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-05-06 07:45:08 +0000 |
commit | 26a72bf1519a8933e3fabc884a024e72947008e0 (patch) | |
tree | b669c81220f0885a37faf8acf3ddb7c02bd8fc19 /squid-model.lua | |
parent | 1b8bad95d1204e4f3f90bfe4f212870d09c44918 (diff) | |
download | acf-squid-26a72bf1519a8933e3fabc884a024e72947008e0.tar.bz2 acf-squid-26a72bf1519a8933e3fabc884a024e72947008e0.tar.xz |
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
Diffstat (limited to 'squid-model.lua')
-rw-r--r-- | squid-model.lua | 25 |
1 files changed, 7 insertions, 18 deletions
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 ) |