luci-app-passwall: use busybox top
* procps-ng conflict
This commit is contained in:
parent
a37d993d4d
commit
afe7eb4304
@ -182,20 +182,20 @@ function status()
|
|||||||
-- local dns_mode = ucic:get(appname, "@global[0]", "dns_mode")
|
-- local dns_mode = ucic:get(appname, "@global[0]", "dns_mode")
|
||||||
local e = {}
|
local e = {}
|
||||||
e.dns_mode_status = luci.sys.call("netstat -apn | grep ':15353 ' >/dev/null") == 0
|
e.dns_mode_status = luci.sys.call("netstat -apn | grep ':15353 ' >/dev/null") == 0
|
||||||
e.haproxy_status = luci.sys.call(string.format("/bin/top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
e.haproxy_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
||||||
e["tcp_node_status"] = luci.sys.call(string.format("/bin/top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep -i 'TCP' >/dev/null", appname)) == 0
|
e["tcp_node_status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep -i 'TCP' >/dev/null", appname)) == 0
|
||||||
|
|
||||||
if (ucic:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" then
|
if (ucic:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" then
|
||||||
e["udp_node_status"] = e["tcp_node_status"]
|
e["udp_node_status"] = e["tcp_node_status"]
|
||||||
else
|
else
|
||||||
e["udp_node_status"] = luci.sys.call(string.format("/bin/top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep -i 'UDP' >/dev/null", appname)) == 0
|
e["udp_node_status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep -i 'UDP' >/dev/null", appname)) == 0
|
||||||
end
|
end
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function haproxy_status()
|
function haproxy_status()
|
||||||
local e = luci.sys.call(string.format("/bin/top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
@ -205,12 +205,12 @@ function socks_status()
|
|||||||
local index = luci.http.formvalue("index")
|
local index = luci.http.formvalue("index")
|
||||||
local id = luci.http.formvalue("id")
|
local id = luci.http.formvalue("id")
|
||||||
e.index = index
|
e.index = index
|
||||||
e.socks_status = luci.sys.call(string.format("/bin/top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' | grep 'SOCKS_' > /dev/null", appname, id)) == 0
|
e.socks_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' | grep 'SOCKS_' > /dev/null", appname, id)) == 0
|
||||||
local use_http = ucic:get(appname, id, "http_port") or 0
|
local use_http = ucic:get(appname, id, "http_port") or 0
|
||||||
e.use_http = 0
|
e.use_http = 0
|
||||||
if tonumber(use_http) > 0 then
|
if tonumber(use_http) > 0 then
|
||||||
e.use_http = 1
|
e.use_http = 1
|
||||||
e.http_status = luci.sys.call(string.format("/bin/top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' | grep -E 'HTTP_|HTTP2SOCKS' > /dev/null", appname, id)) == 0
|
e.http_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' | grep -E 'HTTP_|HTTP2SOCKS' > /dev/null", appname, id)) == 0
|
||||||
end
|
end
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
@ -375,7 +375,7 @@ end
|
|||||||
function server_user_status()
|
function server_user_status()
|
||||||
local e = {}
|
local e = {}
|
||||||
e.index = luci.http.formvalue("index")
|
e.index = luci.http.formvalue("index")
|
||||||
e.status = luci.sys.call(string.format("/bin/top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep -i '%s' >/dev/null", appname .. "_server", luci.http.formvalue("id"))) == 0
|
e.status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep -i '%s' >/dev/null", appname .. "_server", luci.http.formvalue("id"))) == 0
|
||||||
http_write_json(e)
|
http_write_json(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ local function start()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function stop()
|
local function stop()
|
||||||
cmd(string.format("/bin/top -bn1 | grep -v 'grep' | grep '%s/' | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1", CONFIG_PATH))
|
cmd(string.format("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/' | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1", CONFIG_PATH))
|
||||||
ipt("-D INPUT -j PSW-SERVER 2>/dev/null")
|
ipt("-D INPUT -j PSW-SERVER 2>/dev/null")
|
||||||
ipt("-F PSW-SERVER 2>/dev/null")
|
ipt("-F PSW-SERVER 2>/dev/null")
|
||||||
ipt("-X PSW-SERVER 2>/dev/null")
|
ipt("-X PSW-SERVER 2>/dev/null")
|
||||||
|
Loading…
Reference in New Issue
Block a user