diff options
-rw-r--r-- | openvpn-model.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/openvpn-model.lua b/openvpn-model.lua index 0f3627b..719cf13 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -54,7 +54,9 @@ local function config_content( f ) -- Filter out commented lines if not string.find ( l, "^[;#].*" ) then local a,b = string.match ( l, "^%s*(%S*)%s+(%S*).*$" ) - config[a]=b + if (a) then + config[a]=b + end end end if not ( config.log ) then @@ -86,9 +88,11 @@ local is_running = function( process, parameters ) for k,v in pairs(pidofs) do local path = string.gsub("/proc/".. v .. "/cmdline", "%s", "") local f = io.open(path) - local file_resultx = f:read("*a") - local file_result = string.match(file_resultx, parameters) + if (f) then + local file_resultx = f:read("*a") + local file_result = string.match(file_resultx, parameters) f:close() + end if ( file_result ) then retval = "Running" end |