gluon-autoupdater: introduce uci value gluon.autoupdater.minute
This commit is contained in:
parent
4911da56e1
commit
65e1ba0420
@ -40,11 +40,16 @@ local autoupdater_util = require 'autoupdater.util'
|
|||||||
autoupdater_util.randomseed()
|
autoupdater_util.randomseed()
|
||||||
|
|
||||||
|
|
||||||
-- Perform updates at a random time between 04:00 and 05:00, and once an hour
|
-- Perform updates at a random time between 04:00 and 05:00 in case no specific
|
||||||
-- a fallback update (used after the regular updates haven't worked for
|
-- time is specified (gluon.autoupdater.minute), and once an hour a fallback
|
||||||
-- (priority+1) days after a firmware release, for example because the node
|
-- update (used after the regular updates haven't worked for (priority+1) days
|
||||||
-- is always offline at night)
|
-- after a firmware release, for example because the node is always offline at
|
||||||
local minute = math.random(0, 59)
|
-- night)
|
||||||
|
if not uci:get('gluon', 'autoupdater') then
|
||||||
|
uci:section('gluon', 'autoupdater', 'autoupdater')
|
||||||
|
uci:save('gluon')
|
||||||
|
end
|
||||||
|
local minute = uci:get('gluon', 'autoupdater', 'minute') or math.random(0, 59)
|
||||||
|
|
||||||
local f = io.open('/usr/lib/micron.d/autoupdater', 'w')
|
local f = io.open('/usr/lib/micron.d/autoupdater', 'w')
|
||||||
f:write(string.format('%i 4 * * * /usr/sbin/autoupdater\n', minute))
|
f:write(string.format('%i 4 * * * /usr/sbin/autoupdater\n', minute))
|
||||||
|
Loading…
Reference in New Issue
Block a user