aboutsummaryrefslogtreecommitdiffstats
path: root/packages-update.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-01-31 17:52:48 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-01-31 23:16:41 +0100
commit64e53a7d32106e334cedeab48e5d9fc4499cd9f0 (patch)
tree9fc4a914aa28b417f5e0c16867963778739385d2 /packages-update.rsc
parent461f7b6e76c39c941a3b38a6633df46c3d13a278 (diff)
packages-update: schedule reboot at pre-calculated time
Diffstat (limited to 'packages-update.rsc')
-rw-r--r--packages-update.rsc10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages-update.rsc b/packages-update.rsc
index 8b7d617..863d273 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -23,19 +23,19 @@
:global PackagesUpdateDeferReboot;
:local Schedule do={
+ :global GetRandomNumber;
:global LogPrintExit2;
:global RebootForUpdate do={
- :global RandomDelay;
- $RandomDelay 3600;
/system/reboot;
}
- /system/scheduler/add name="_RebootForUpdate" start-time=03:00:00 interval=1d \
+ :local StartTime [ :tostr [ :totime (10800 + [ $GetRandomNumber 7200 ]) ] ];
+ /system/scheduler/add name="_RebootForUpdate" start-time=$StartTime interval=1d \
on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
":global RebootForUpdate; \$RebootForUpdate;");
- $LogPrintExit2 info $1 ("Scheduled reboot for update between 3 AM and 4 AM local time (" . \
- [ /system/clock/get time-zone-name ] . ").") true;
+ $LogPrintExit2 info $1 ("Scheduled reboot for update at " . $StartTime . \
+ " local time (" . [ /system/clock/get time-zone-name ] . ").") true;
}
$ScriptLock $0;