summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-openvpn
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-openvpn')
-rw-r--r--applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
index 719145b88..ccad53151 100644
--- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
+++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
@@ -26,9 +26,9 @@ uci:foreach( "openvpn_recipes", "openvpn_recipe",
)
function s.getPID(section) -- Universal function which returns valid pid # or nil
- local pid = sys.exec("%s | grep -w %s | grep openvpn | grep -v grep | awk '{print $1}'" % { psstring,section} )
- if pid and #pid > 0 and tonumber(pid) ~= nil then
- return tonumber(pid)
+ local pid = sys.exec("%s | grep -w [o]penvpn(%s)" % { psstring, section })
+ if pid and #pid > 0 then
+ return tonumber(pid:match("^%d+"))
else
return nil
end