mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
capsman-download-packages: split off capsman-rolling-upgrade
This commit is contained in:
parent
f127e3b7ef
commit
74683b3fc8
2 changed files with 25 additions and 8 deletions
|
@ -30,13 +30,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
:local RemoteCapCount [ /caps-man remote-cap print count-only ];
|
||||
:if ($Updated = true && $RemoteCapCount > 0) do={
|
||||
:local Delay (600 / $RemoteCapCount);
|
||||
:if ($Delay > 120) do={ :set Delay 120; }
|
||||
:foreach RemoteCap in=[ / caps-man remote-cap find where version!=$InstalledVersion ] do={
|
||||
:log debug ("Starting upgrade for CAP " . [ / caps-man remote-cap get $RemoteCap name ] . "...");
|
||||
/ caps-man remote-cap upgrade $RemoteCap;
|
||||
:delay ($Delay . "s");
|
||||
:if ($Updated = true) do={
|
||||
:if ([ / system script print count-only where name="capsman-rolling-upgrade" ] > 0) do={
|
||||
/ system script run capsman-rolling-upgrade;
|
||||
} else={
|
||||
/ caps-man remote-cap upgrade [ find where version!=$InstalledVersion ];
|
||||
}
|
||||
}
|
||||
|
|
20
capsman-rolling-upgrade
Normal file
20
capsman-rolling-upgrade
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!rsc
|
||||
# RouterOS script: capsman-rolling-upgrade
|
||||
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
#
|
||||
# upgrade CAPs one after another
|
||||
|
||||
:local InstalledVersion [ / system package update get installed-version ];
|
||||
|
||||
:local RemoteCapCount [ /caps-man remote-cap print count-only ];
|
||||
:if ($RemoteCapCount > 0) do={
|
||||
:local Delay (600 / $RemoteCapCount);
|
||||
:if ($Delay > 120) do={ :set Delay 120; }
|
||||
:foreach RemoteCap in=[ / caps-man remote-cap find where version!=$InstalledVersion ] do={
|
||||
:local RemoteCapName [ / caps-man remote-cap get $RemoteCap name ];
|
||||
:log debug ("Starting upgrade for CAP " . $RemoteCapName . "...");
|
||||
/ caps-man remote-cap upgrade $RemoteCap;
|
||||
:delay ($Delay . "s");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue