Compare commits

..

No commits in common. "09931828398dd29db33d7c370d31a818bf9c652f" and "77c69f651b8eed6fd5dd17f5ec8fc9f897acbccb" have entirely different histories.

4 changed files with 6 additions and 12 deletions

3
default-init.txt Normal file
View File

@ -0,0 +1,3 @@
getty.lua
fsmanager.lua
minitel.lua

View File

@ -1,7 +1,6 @@
local serial = require "serialization" local serial = require "serialization"
local rc = {} local rc = {}
rc.pids = {}
local service = {} local service = {}
local cfg = {} local cfg = {}
cfg.enabled = {} cfg.enabled = {}
@ -38,20 +37,12 @@ end
function rc.stop(name,...) function rc.stop(name,...)
if not service[name] then return false, "service not found" end if not service[name] then return false, "service not found" end
service[name].stop(...) service[name].stop(...)
coroutine.yield()
if rc.pids[name] then
os.kill(rc.pids[name])
end
rc.pids[name] = nil
end end
function rc.start(name,...) function rc.start(name,...)
rc.load(name) rc.load(name)
if not service[name] then return false, "service not found" end if not service[name] then return false, "service not found" end
local rv = {service[name].start(...)} return service[name].start(...)
if type(rv[1]) == "number" then
rc.pids[name] = rv[1]
end
end end
function rc.restart(name) function rc.restart(name)

View File

@ -12,7 +12,7 @@ end
local function formatValue(v) local function formatValue(v)
if type(v) == "table" then if type(v) == "table" then
local w, rs = pcall(serial.serialize,v,true) local w, rs = pcall(serial.serialize,v)
if w then return rs end if w then return rs end
end end
return tostring(v) return tostring(v)

View File

@ -55,10 +55,10 @@ local function allocate()
end end
function start() function start()
basepid = os.spawn(function()
scan() scan()
allocate() allocate()
dprint("screens ready") dprint("screens ready")
basepid = os.spawn(function()
while true do while true do
coroutine.yield() coroutine.yield()
for k,v in pairs(pids) do for k,v in pairs(pids) do