blob: 4b8c07f56a9d24a2ce9f6d7a631bc0c9927e31bf (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
module(..., package.seeall)
-- Load libraries
require("modelfunctions")
fs = require("acf.fs")
-- ################################################################################
-- SET VARIABLES
local packagename="vlc-daemon"
local processname="vlc"
local configfile = "/etc/conf.d/"..tostring(processname)
local logfile = "/var/log/vlc/vlc.log"
function set_processname(p)
processname = p
configfile = "/etc/conf.d/"..tostring(processname)
end
-- ################################################################################
-- LOCAL FUNCTIONS
-- ################################################################################
-- PUBLIC FUNCTIONS
function get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
function startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
function getstatus()
return modelfunctions.getstatus(processname, packagename, tostring(processname).." Status")
end
function getconfigfile()
-- FIXME Validate
return modelfunctions.getfiledetails(configfile)
end
function get_filedetails()
local path=logfile
local path2
if fs.is_file(configfile) then
for line in string.gmatch(fs.read_file(configfile) or "", "(.-)\n") do
path2=string.match(line,"^VLC_OPTS.*--logfile%s+(%S+)") or path2
end
end
if path2 then path=path2 end
return modelfunctions.getfiledetails(path)
end
function setconfigfile(self, filedetails)
-- FIXME Validate
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
function getleases()
return modelfunctions.getfiledetails(leasefile)
end
|