summaryrefslogtreecommitdiffstats
path: root/tinydns-model.lua
blob: 176da46cfdb21ed1683cb72eb2f42e6b21d88053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module(..., package.seeall)

require("procps")

local processname = "tinydns"
local configfile = "???"

-- ################################################################################
-- LOCAL FUNCTIONS

local function get_version()
	local cmd = "/sbin/apk_version -vs " .. processname .." 2>/dev/null"
	local f = io.popen( cmd )
	local cmd_output_result = f:read("*l")
	f:close()
	return cmd_output_result
end

-- ################################################################################
-- PUBLIC FUNCTIONS

function getstatus()
--	local opts = getconfig()
	local status = {}
	status.version = cfe({ name = "version",
		label="Program version",
		value=get_version(),
		 })
	status.status = cfe({ name="status",
		label="Program status",
		value=procps.pidof(processname),
		})

--[[
	if (opts["remotelogging"]) and not ((opts["remotelogging"]["value"] ~= "") and not (opts["localandnetworklog"]["value"])) then
		status.logfile = cfe({ name="logfile",
			label="Locally logging to",
			value=opts["logfile"]["value"],
			})
	end
	if (opts["SYSLOGD_OPTS"]) and (opts["SYSLOGD_OPTS"]["-R"]) and (opts["SYSLOGD_OPTS"]["-R"] ~= "") then
		status.remote = cfe({ name="remotelogging",
			label="Remote logging to",
			value=opts["SYSLOGD_OPTS"]["-R"],
			})
	end
--]]
	return status
end