Skip to content
Snippets Groups Projects
Commit 9510d03b authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-autoupdater: perform fallback updates hourly

parent 35d8ff57
No related branches found
No related tags found
No related merge requests found
#!/bin/sh /etc/rc.common
START=99
SERVICE_NAME=gluon-autoupdater
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
start() {
[ "$(uci get autoupdater.settings.enabled)" = 1 ] || return
service_start /bin/sh /lib/gluon/autoupdater/delayed_update
}
stop() {
service_stop /bin/sh
}
#!/bin/sh
lock /var/gluon/autoupdater.lock
autoupdater "$@"
lock -u /var/gluon/autoupdater.lock
#!/bin/sh
# wait for 5 minutes after boot
sleep 300
exec /lib/gluon/autoupdater/autoupdate -o
...@@ -47,7 +47,11 @@ local autoupdater_util = require 'autoupdater.util' ...@@ -47,7 +47,11 @@ local autoupdater_util = require 'autoupdater.util'
autoupdater_util.randomseed() autoupdater_util.randomseed()
-- Perform updates at a random time between 04:00 and 05:00 -- Perform updates at a random time between 04:00 and 05:00, and once an hour
-- a fallback update (used after the regular updates haven't
local minute = math.random(0, 59)
local f = io.open('/lib/gluon/cron/autoupdater', 'w') local f = io.open('/lib/gluon/cron/autoupdater', 'w')
f:write(string.format('%i 4 * * * /lib/gluon/autoupdater/autoupdate\n', math.random(0, 59))) f:write(string.format('%i 4 * * * /usr/sbin/autoupdater\n', minute))
f:write(string.format('%i 0-3,5-23 * * * /usr/sbin/autoupdater --fallback\n', minute))
f:close() f:close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment