diff options
author | Christian Hesse <mail@eworm.de> | 2024-01-31 17:46:31 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-01-31 23:10:15 +0100 |
commit | 461f7b6e76c39c941a3b38a6633df46c3d13a278 (patch) | |
tree | cac9d48d1d8e64e3a8dad26565f172ea93269bfa | |
parent | 237dcd7261a33a4c222df486a8b895a496ef0ef3 (diff) |
packages-update: move output and logging to local function...
... and pass script name for clean logging.
-rw-r--r-- | packages-update.rsc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages-update.rsc b/packages-update.rsc index 3e18413..8b7d617 100644 --- a/packages-update.rsc +++ b/packages-update.rsc @@ -23,14 +23,19 @@ :global PackagesUpdateDeferReboot; :local Schedule do={ + :global LogPrintExit2; + :global RebootForUpdate do={ :global RandomDelay; $RandomDelay 3600; /system/reboot; } + /system/scheduler/add name="_RebootForUpdate" start-time=03:00:00 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; } $ScriptLock $0; @@ -107,18 +112,14 @@ $ScriptLock $0; /system/package/downgrade; } -:local Message ("Scheduled reboot for update between 3 AM and 4 AM local time (" . \ - [ /system/clock/get time-zone-name ] . ")."); :if ([ $ScriptFromTerminal $0 ] = true) do={ :put "Do you want to (s)chedule reboot or (r)eboot now? [s/R]"; :if (([ /terminal/inkey timeout=60 ] % 32) = 19) do={ - $Schedule; - $LogPrintExit2 info $0 $Message true; + $Schedule $0; } } else={ :if ($PackagesUpdateDeferReboot = true) do={ - $Schedule; - $LogPrintExit2 info $0 $Message true; + $Schedule $0; } } |