mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-09 20:54:34 +02:00
packages-update: schedule from local function
This commit is contained in:
parent
abfc8e9191
commit
98f26989f5
1 changed files with 12 additions and 8 deletions
|
@ -18,6 +18,17 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global VersionToNum;
|
:global VersionToNum;
|
||||||
|
|
||||||
|
:local Schedule do={
|
||||||
|
: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;");
|
||||||
|
}
|
||||||
|
|
||||||
$ScriptLock $0;
|
$ScriptLock $0;
|
||||||
|
|
||||||
:local Update [ /system/package/update/get ];
|
:local Update [ /system/package/update/get ];
|
||||||
|
@ -95,14 +106,7 @@ $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={
|
$Schedule;
|
||||||
: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 $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