mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-06-22 09:53:33 +02:00
packages-update: put reboot into a function
Make the logic even simpler... Let's put the reboot code into a function. That is volatile, so device does not reboot if it is rebooted already.
This commit is contained in:
parent
7c2ac135e3
commit
49e89070a1
1 changed files with 6 additions and 2 deletions
|
@ -81,10 +81,14 @@ $ScriptLock $0;
|
||||||
:if ([ $ScriptFromTerminal $0 ] = true) do={
|
:if ([ $ScriptFromTerminal $0 ] = true) do={
|
||||||
:put "Do you want to (s)chedule reboot or (r)eboot now? [s/R]";
|
:put "Do you want to (s)chedule reboot or (r)eboot now? [s/R]";
|
||||||
:if (([ /terminal/inkey timeout=60 ] % 32) = 19) do={
|
:if (([ /terminal/inkey timeout=60 ] % 32) = 19) do={
|
||||||
|
:global RebootForUpdate do={
|
||||||
|
:global RandomDelay;
|
||||||
|
$RandomDelay 3600;
|
||||||
|
/system/reboot;
|
||||||
|
}
|
||||||
/system/scheduler/add name="reboot-for-update" start-time=03:00:00 interval=1d \
|
/system/scheduler/add name="reboot-for-update" start-time=03:00:00 interval=1d \
|
||||||
on-event=("/system/scheduler/remove reboot-for-update; " . \
|
on-event=("/system/scheduler/remove reboot-for-update; " . \
|
||||||
":if ([ /system/package/update/get installed-version ] != \"" . $Update->"latest-version" . "\") " . \
|
":global RebootForUpdate; \$RebootForUpdate;");
|
||||||
"do={ :global RandomDelay; \$RandomDelay 3600; /system/reboot; }");
|
|
||||||
$LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
|
$LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue