diff options
author | Mika Havela <mika.havela@gmail.com> | 2007-11-19 16:17:14 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2007-11-19 16:17:14 +0000 |
commit | cf6ff477f4bf27a00efd2e603f7bb87f6a4f0824 (patch) | |
tree | 4df9a2e8604061e8236e7b45bd511a220cd907b9 /openvpn-model.lua | |
parent | 723453ae5dced317e70f6597efe17b4872ea35a2 (diff) | |
download | acf-openvpn-cf6ff477f4bf27a00efd2e603f7bb87f6a4f0824.tar.bz2 acf-openvpn-cf6ff477f4bf27a00efd2e603f7bb87f6a4f0824.tar.xz |
Initial functionsv1.0_alpha1
git-svn-id: svn://svn.alpinelinux.org/acf/openvpn/trunk@338 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openvpn-model.lua')
-rw-r--r-- | openvpn-model.lua | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/openvpn-model.lua b/openvpn-model.lua index 4e60764..2a86809 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -22,15 +22,16 @@ local function read_file_as_array ( path ) end -local is_running = function( process ) +local is_running = function( process, parameters ) local retval = false - local file = io.popen("pidof " .. process) - if file ~= nil then - local line = file:read( "*l" ) + local pidofs = io.popen("pidof " .. process) + if pidofs ~= nil then + for pidof in string.gsub(pidofs, "%a+") do + local file = io.open( "/proc/" .. pidof .. "/cmdline" ) + local file_result = file:read("*a") or "unknown" file:close() - if #line > 0 then - retval = true - end + retval = file_result + end end return retval @@ -125,7 +126,9 @@ function list_conffiles() for a,b in ipairs(files) do if string.match (b, "^.*conf$") then local conf_type = check_valid_config ( b ) - local init_script = has_init_script ( string.gsub(b, "(%w+)(\..*)", "%1") ) +-- local init_script = is_running ( string.gsub(b, "(%w+)(\..*)", "%1") ) + -- local init_script = string.gsub(b, "(%w+)(\..*)", "%1") + local init_script = is_running ("openvpn", b) table.insert ( conlistfiles, cfe{ value = b, type = conf_type, init = init_script} ) end end |