From 9510d03b8b7c80549cbd4215713f7451604664be Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 25 Jul 2014 15:52:50 +0200 Subject: [PATCH] gluon-autoupdater: perform fallback updates hourly --- .../files/etc/init.d/gluon-autoupdater | 18 ------------------ .../files/lib/gluon/autoupdater/autoupdate | 5 ----- .../files/lib/gluon/autoupdater/delayed_update | 5 ----- .../autoupdater/invariant/010-autoupdater | 8 ++++++-- 4 files changed, 6 insertions(+), 30 deletions(-) delete mode 100755 package/gluon-autoupdater/files/etc/init.d/gluon-autoupdater delete mode 100755 package/gluon-autoupdater/files/lib/gluon/autoupdater/autoupdate delete mode 100755 package/gluon-autoupdater/files/lib/gluon/autoupdater/delayed_update diff --git a/package/gluon-autoupdater/files/etc/init.d/gluon-autoupdater b/package/gluon-autoupdater/files/etc/init.d/gluon-autoupdater deleted file mode 100755 index 45a1ef62..00000000 --- a/package/gluon-autoupdater/files/etc/init.d/gluon-autoupdater +++ /dev/null @@ -1,18 +0,0 @@ -#!/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 -} diff --git a/package/gluon-autoupdater/files/lib/gluon/autoupdater/autoupdate b/package/gluon-autoupdater/files/lib/gluon/autoupdater/autoupdate deleted file mode 100755 index b1fe84eb..00000000 --- a/package/gluon-autoupdater/files/lib/gluon/autoupdater/autoupdate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -lock /var/gluon/autoupdater.lock -autoupdater "$@" -lock -u /var/gluon/autoupdater.lock diff --git a/package/gluon-autoupdater/files/lib/gluon/autoupdater/delayed_update b/package/gluon-autoupdater/files/lib/gluon/autoupdater/delayed_update deleted file mode 100755 index 95841f86..00000000 --- a/package/gluon-autoupdater/files/lib/gluon/autoupdater/delayed_update +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# wait for 5 minutes after boot -sleep 300 -exec /lib/gluon/autoupdater/autoupdate -o diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater index 4ccede22..fec313b3 100755 --- a/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater +++ b/package/gluon-autoupdater/files/lib/gluon/upgrade/autoupdater/invariant/010-autoupdater @@ -47,7 +47,11 @@ local autoupdater_util = require 'autoupdater.util' 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') -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()