mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 02:03:56 +08:00
update 2026-09-26 11:07:27
This commit is contained in:
1 parent
7b88b273d0
commit
97ae9f68da
4898 files changed
-1712274
No files matched your search
@@ -1,31 +0,0 @@
|
||||
module("luci.controller.npc",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/npc") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "npc"}, cbi("npc"), _("NPS Client"), 99).dependent = true
|
||||
entry({"admin", "services", "npc", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local fs = require "nixio.fs"
|
||||
local e = {}
|
||||
|
||||
if not fs.access("/usr/bin/npc") then
|
||||
e.installed = false
|
||||
e.running = false
|
||||
e.version = ""
|
||||
e.core_version = ""
|
||||
else
|
||||
e.installed = true
|
||||
e.running = (luci.sys.call("pgrep npc > /dev/null") == 0)
|
||||
local ver_out = luci.sys.exec("/usr/bin/npc -version 2>/dev/null")
|
||||
e.version = ver_out:match("Version:%s*([v%d%.%-]+)") or ""
|
||||
e.core_version = ver_out:match("Core version:%s*([v%d%.%-]+)") or ""
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
Reference in new issue
Block a user