mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-29 06:18:54 +02:00
Compare commits
No commits in common. "main" and "routeros-7.20beta2-1" have entirely different histories.
main
...
routeros-7
21 changed files with 55 additions and 107 deletions
|
@ -35,7 +35,6 @@ Add yourself to the list,
|
|||
[donate with PayPal ↗️](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)!
|
||||
|
||||
* Abdul Mannan Abbasi
|
||||
* Alex Maier
|
||||
* Andrea Ruffini Perico
|
||||
* Andrew Cox
|
||||
* Christoph Boss (@Kampfwurst)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
:foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local Mac [ /caps-man/access-list/get $AccList mac-address ];
|
||||
:if ($Seen->$Mac = 1) do={
|
||||
/caps-man/access-list/print without-paging where mac-address=$Mac;
|
||||
/caps-man/access-list/print where mac-address=$Mac;
|
||||
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
|
||||
|
||||
:if ([ :typeof $Remove ] = "num") do={
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
:foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
|
||||
:if ($Seen->$Mac = 1) do={
|
||||
/interface/wireless/access-list/print without-paging where mac-address=$Mac;
|
||||
/interface/wireless/access-list/print where mac-address=$Mac;
|
||||
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
|
||||
|
||||
:if ([ :typeof $Remove ] = "num") do={
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
:local Mac [ /interface/wifi/access-list/get $AccList mac-address ];
|
||||
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
|
||||
:if ($Seen->$Mac = 1) do={
|
||||
/caps-man/access-list/print without-paging where mac-address=$Mac;
|
||||
/interface/wifi/access-list/print without-paging where mac-address=$Mac;
|
||||
/interface/wireless/access-list/print without-paging where mac-address=$Mac;
|
||||
/caps-man/access-list/print where mac-address=$Mac;
|
||||
/interface/wifi/access-list/print where mac-address=$Mac;
|
||||
/interface/wireless/access-list/print where mac-address=$Mac;
|
||||
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
|
||||
|
||||
:if ([ :typeof $Remove ] = "num") do={
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
:foreach AccList in=[ /interface/wifi/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local Mac [ /interface/wifi/access-list/get $AccList mac-address ];
|
||||
:if ($Seen->$Mac = 1) do={
|
||||
/interface/wifi/access-list/print without-paging where mac-address=$Mac;
|
||||
/interface/wifi/access-list/print where mac-address=$Mac;
|
||||
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
|
||||
|
||||
:if ([ :typeof $Remove ] = "num") do={
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
# requires RouterOS, version=7.18
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://rsc.eworm.de/doc/capsman-download-packages.md
|
||||
|
@ -54,8 +54,8 @@
|
|||
"). Please place your packages!");
|
||||
}
|
||||
|
||||
:foreach Package in=[ /file/find where type="package" \
|
||||
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
|
||||
:foreach Package in=[ /file/find recursive where path=$PackagePath \
|
||||
type="package" package-version!=$InstalledVersion ] do={
|
||||
:local File [ /file/get $Package ];
|
||||
:if ($File->"package-architecture" = "mips") do={
|
||||
:set ($File->"package-architecture") "mipsbe";
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /file/find where type="package" name~("^" . $PackagePath) ] ] = 0) do={
|
||||
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
|
||||
$LogPrint info $ScriptName ("No packages available, downloading default set.");
|
||||
:foreach Arch in={ "arm"; "mipsbe" } do={
|
||||
:foreach Package in={ "routeros"; "wireless" } do={
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
# requires RouterOS, version=7.18
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://rsc.eworm.de/doc/capsman-download-packages.md
|
||||
|
@ -56,8 +56,8 @@
|
|||
"). Please place your packages!");
|
||||
}
|
||||
|
||||
:foreach Package in=[ /file/find where type="package" \
|
||||
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
|
||||
:foreach Package in=[ /file/find recursive where path=$PackagePath \
|
||||
type="package" package-version!=$InstalledVersion ] do={
|
||||
:local File [ /file/get $Package ];
|
||||
:if ($File->"package-architecture" = "mips") do={
|
||||
:set ($File->"package-architecture") "mipsbe";
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /file/find where type="package" name~("^" . $PackagePath) ] ] = 0) do={
|
||||
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
|
||||
$LogPrint info $ScriptName ("No packages available, downloading default set.");
|
||||
# NOT /interface/wifi/ #
|
||||
:foreach Arch in={ "arm"; "mipsbe" } do={
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
# requires RouterOS, version=7.18
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://rsc.eworm.de/doc/capsman-download-packages.md
|
||||
|
@ -54,8 +54,8 @@
|
|||
"). Please place your packages!");
|
||||
}
|
||||
|
||||
:foreach Package in=[ /file/find where type="package" \
|
||||
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
|
||||
:foreach Package in=[ /file/find recursive where path=$PackagePath \
|
||||
type="package" package-version!=$InstalledVersion ] do={
|
||||
:local File [ /file/get $Package ];
|
||||
:if ($File->"package-architecture" = "mips") do={
|
||||
:set ($File->"package-architecture") "mipsbe";
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /file/find where type="package" name~("^" . $PackagePath) ] ] = 0) do={
|
||||
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
|
||||
$LogPrint info $ScriptName ("No packages available, downloading default set.");
|
||||
:foreach Arch in={ "arm"; "arm64" } do={
|
||||
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
:global CheckHealthPlugins;
|
||||
|
||||
:set ($CheckHealthPlugins->[ :jobname ]) do={
|
||||
:local FuncName [ :tostr $0 ];
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local FuncName [ :tostr $0 ];
|
||||
|
||||
:global CheckHealthLast;
|
||||
:global Identity;
|
||||
|
@ -33,13 +32,13 @@
|
|||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||
:if ($CheckHealthLast->$Name = "ok" && \
|
||||
$Value != "ok") do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
|
||||
message=("The device '" . $Name . "' on " . $Identity . " failed!") });
|
||||
}
|
||||
:if ($CheckHealthLast->$Name != "ok" && \
|
||||
$Value = "ok") do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||
message=("The device '" . $Name . "' on " . $Identity . " recovered!") });
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
:global CheckHealthPlugins;
|
||||
|
||||
:set ($CheckHealthPlugins->[ :jobname ]) do={
|
||||
:local FuncName [ :tostr $0 ];
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local FuncName [ :tostr $0 ];
|
||||
|
||||
:global CheckHealthLast;
|
||||
:global CheckHealthTemperature;
|
||||
|
@ -55,7 +54,7 @@
|
|||
}
|
||||
:if ($Value > $CheckHealthTemperature->$Name && \
|
||||
$CheckHealthTemperatureNotified->$Name != true) do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " is above threshold: " . \
|
||||
$Value . "\C2\B0" . "C") });
|
||||
|
@ -63,7 +62,7 @@
|
|||
}
|
||||
:if ($Value <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \
|
||||
$CheckHealthTemperatureNotified->$Name = true) do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \
|
||||
$Value . "\C2\B0" . "C") });
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
:global CheckHealthPlugins;
|
||||
|
||||
:set ($CheckHealthPlugins->[ :jobname ]) do={
|
||||
:local FuncName [ :tostr $0 ];
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local FuncName [ :tostr $0 ];
|
||||
|
||||
:global CheckHealthLast;
|
||||
:global CheckHealthVoltageLow;
|
||||
|
@ -40,7 +39,7 @@
|
|||
|
||||
:if ($NumLast * (100 + $CheckHealthVoltagePercent) < $NumCurr * 100 || \
|
||||
$NumLast * 100 > $NumCurr * (100 + $CheckHealthVoltagePercent)) do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification ("high-voltage-sign,chart-" . [ $IfThenElse ($NumLast < \
|
||||
$NumCurr) "in" "de" ] . "creasing") ] . "Health warning: " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
|
||||
|
@ -48,12 +47,12 @@
|
|||
[ $FormatLine "new value" ($Value . " V") 12 ]) });
|
||||
} else={
|
||||
:if ($NumCurr <= $CheckHealthVoltageLow && $NumLast > $CheckHealthVoltageLow) do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "high-voltage-sign,chart-decreasing" ] . "Health warning: Low " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " dropped to " . $Value . " V below hard limit.") });
|
||||
}
|
||||
:if ($NumCurr > $CheckHealthVoltageLow && $NumLast <= $CheckHealthVoltageLow) do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
$SendNotification2 ({ origin=$FuncName; \
|
||||
subject=([ $SymbolForNotification "high-voltage-sign,chart-increasing" ] . "Health recovery: Low " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " recovered to " . $Value . " V above hard limit.") });
|
||||
}
|
||||
|
|
|
@ -92,16 +92,16 @@
|
|||
:onerror Err {
|
||||
/system/script/run $Plugin;
|
||||
} do={
|
||||
$LogPrint error $ScriptName ("Plugin '" . $PluginVal->"name" . "' failed to run: " . $Err);
|
||||
$LogPrint error $ScriptName ("Plugin '" . $ScriptVal->"name" . "' failed to run: " . $Err);
|
||||
}
|
||||
} else={
|
||||
$LogPrint error $ScriptName ("Plugin '" . $PluginVal->"name" . "' failed syntax validation, skipping.");
|
||||
$LogPrint error $ScriptName ("Plugin '" . $ScriptVal->"name" . "' failed syntax validation, skipping.");
|
||||
}
|
||||
}
|
||||
|
||||
:foreach PluginName,Discard in=$CheckHealthPlugins do={
|
||||
($CheckHealthPlugins->$PluginName) \
|
||||
("\$CheckHealthPlugins->\"" . $PluginName . "\"") $ScriptName;
|
||||
("\$CheckHealthPlugins->\"" . $PluginName . "\"");
|
||||
}
|
||||
|
||||
:set CheckHealthPlugins;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
:global EscapeForRegEx;
|
||||
:global FetchUserAgentStr;
|
||||
:global LogPrint;
|
||||
:global RebootForUpdate;
|
||||
:global ScriptFromTerminal;
|
||||
:global ScriptLock;
|
||||
:global SendNotification2;
|
||||
|
@ -63,14 +62,9 @@
|
|||
$WaitFullyConnected;
|
||||
|
||||
:if ([ :len [ /system/scheduler/find where name="_RebootForUpdate" ] ] > 0) do={
|
||||
:if ([ :typeof $RebootForUpdate ] = "nothing") do={
|
||||
$LogPrint info $ScriptName ("Found a stale scheduler for reboot, removing.");
|
||||
/system/scheduler/remove "_RebootForUpdate";
|
||||
} else={
|
||||
$LogPrint info $ScriptName ("A reboot for update is already scheduled.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$LogPrint info $ScriptName ("A reboot for update is already scheduled.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
$LogPrint debug $ScriptName ("Checking for updates...");
|
||||
|
|
|
@ -4,7 +4,7 @@ Download packages for CAP upgrade from CAPsMAN
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
@ -33,9 +33,6 @@ certificate is checked.
|
|||
> ⚠️ **Warning**: The script does not limit the size of a list, but keep in
|
||||
> mind that huge lists can exhaust your device's resources (RAM and CPU),
|
||||
> and may take a long time to process.
|
||||
> Even crashes for the complete scripting (and CLI) subsystem are possible.
|
||||
> This should be logged accordingly with warnings when global functions are
|
||||
> reloaded from scheduler.
|
||||
|
||||
Requirements and installation
|
||||
-----------------------------
|
||||
|
|
|
@ -46,8 +46,8 @@ Configuration
|
|||
|
||||
The configuration goes to `global-config-overlay`, this is the only parameter:
|
||||
|
||||
* `PackagesUpdateDeferReboot`: defer the reboot for night (between 3 AM and
|
||||
5 AM), use a numerical value in days suffixed with a `d` to defer further
|
||||
* `PackagesUpdateDeferReboot`: defer the reboot for night (between 3 AM
|
||||
and 5 AM)
|
||||
|
||||
By modifying the scheduler's `start-time` you can force the reboot at
|
||||
different time.
|
||||
|
|
|
@ -48,12 +48,6 @@
|
|||
}
|
||||
$WaitFullyConnected;
|
||||
|
||||
:if ([ :len [ /log/find where topics=({"script"; "warning"}) \
|
||||
message=("\$LogPrintOnce: The message is already in log, scripting subsystem may have crashed before!") ] ] > 0) do={
|
||||
$LogPrintOnce warning $ScriptName ("Scripting subsystem may have crashed, possibly caused by us. Delaying!");
|
||||
:delay 5m;
|
||||
}
|
||||
|
||||
:local ListComment ("managed by " . $ScriptName);
|
||||
|
||||
:foreach FwListName,FwList in=$FwAddrLists do={
|
||||
|
|
|
@ -133,11 +133,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /certificate/find where common-name=$CommonName ] ] > 1) do={
|
||||
$LogPrint info $0 ("There are " . $CertCount . " Certificates with CommonName '" . $CommonName . "'. Should be ok.");
|
||||
:return true;
|
||||
}
|
||||
|
||||
:local CertVal [ /certificate/get [ find where common-name=$CommonName ] ];
|
||||
:while (($CertVal->"akid") != "" && ($CertVal->"akid") != ($CertVal->"skid")) do={
|
||||
:if ([ :len [ /certificate/find where skid=($CertVal->"akid") ] ] = 0) do={
|
||||
|
@ -564,12 +559,6 @@
|
|||
:set FileGet do={
|
||||
:local FileName [ :tostr $1 ];
|
||||
|
||||
:global WaitForFile;
|
||||
|
||||
:if ([ $WaitForFile $FileName 0s ] = false) do={
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local FileVal false;
|
||||
:do {
|
||||
:set FileVal [ /file/get $FileName ];
|
||||
|
@ -1613,9 +1602,7 @@
|
|||
|
||||
:global LogPrintOnce;
|
||||
|
||||
:global SymbolsExtra;
|
||||
|
||||
:local Symbols ({
|
||||
:local Symbols {
|
||||
"abacus"="\F0\9F\A7\AE";
|
||||
"alarm-clock"="\E2\8F\B0";
|
||||
"arrow-down"="\E2\AC\87";
|
||||
|
@ -1650,7 +1637,7 @@
|
|||
"star"="\E2\AD\90";
|
||||
"warning-sign"="\E2\9A\A0";
|
||||
"white-heavy-check-mark"="\E2\9C\85"
|
||||
}, $SymbolsExtra);
|
||||
}
|
||||
|
||||
:if ([ :len ($Symbols->$Name) ] = 0) do={
|
||||
$LogPrintOnce warning $0 ("No symbol available for name '" . $Name . "'!");
|
||||
|
@ -1784,26 +1771,14 @@
|
|||
:global MAX;
|
||||
|
||||
:set FileName [ $CleanFilePath $FileName ];
|
||||
:local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 9);
|
||||
:local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 10);
|
||||
|
||||
:do {
|
||||
:retry {
|
||||
:if ([ :len [ /file/find where name=$FileName ] ] = 0) do={
|
||||
:error false;
|
||||
}
|
||||
} delay=$Delay max=10;
|
||||
} on-error={
|
||||
:return false;
|
||||
}
|
||||
|
||||
:while ([ :len [ /file/find where name=$FileName ] ] > 0) do={
|
||||
:do {
|
||||
/file/get $FileName;
|
||||
:return true;
|
||||
} on-error={ }
|
||||
:delay $Delay;
|
||||
:set Delay ($Delay * 3 / 2);
|
||||
}
|
||||
} delay=$Delay max=10;
|
||||
} on-error={ }
|
||||
|
||||
:return false;
|
||||
}
|
||||
|
|
|
@ -119,13 +119,11 @@
|
|||
|
||||
:local Data false;
|
||||
:onerror Err {
|
||||
:retry {
|
||||
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
||||
http-header-field=({ "accept: application/dns-message" }) \
|
||||
url=(($DohServer->"doh-url") . "?dns=" . [ :convert to=base64 ([ :rndstr length=2 ] . \
|
||||
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm\02de\00" . \
|
||||
"\00\10" . "\00\01") ]) as-value ]->"data");
|
||||
} delay=1s max=3;
|
||||
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
||||
http-header-field=({ "accept: application/dns-message" }) \
|
||||
url=(($DohServer->"doh-url") . "?dns=" . [ :convert to=base64 ([ :rndstr length=2 ] . \
|
||||
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm\02de\00" . \
|
||||
"\00\10" . "\00\01") ]) as-value ]->"data");
|
||||
} do={
|
||||
$LogPrint warning $ScriptName ("Request to DoH server " . ($DohServer->"doh-url") . \
|
||||
" failed: " . $Err);
|
||||
|
|
|
@ -62,14 +62,14 @@
|
|||
|
||||
:local FwAddrList ($ScriptName . "-" . [ $GetRandom20CharAlNum ]);
|
||||
:if ([ :typeof [ :toip $Expected ] ] = "ip") do={
|
||||
/ip/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=30s;
|
||||
/ip/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s;
|
||||
:delay 20ms;
|
||||
:if ([ :len [ /ip/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={
|
||||
:return true;
|
||||
}
|
||||
}
|
||||
:if ([ :typeof [ :toip6 $Expected ] ] = "ip6") do={
|
||||
/ipv6/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=30s;
|
||||
/ipv6/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s;
|
||||
:delay 20ms;
|
||||
:if ([ :len [ /ipv6/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={
|
||||
:return true;
|
||||
|
@ -127,7 +127,7 @@
|
|||
$LogPrint [ $IfThenElse ($HostInfo->"no-resolve-fail" != true) warning debug ] \
|
||||
$ScriptName ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse \
|
||||
($HostInfo->"resolve" != $HostInfo->"name") ("' for " . $Type . " '" . \
|
||||
$HostInfo->"name") "" ] . "' failed third time: " . $Err);
|
||||
$HostInfo->"name") "" ] . "' failed: " . $Err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,25 +31,19 @@
|
|||
:local Schedule do={
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
|
||||
:global PackagesUpdateDeferReboot;
|
||||
|
||||
:global GetRandomNumber;
|
||||
:global IfThenElse;
|
||||
:global LogPrint;
|
||||
|
||||
:global RebootForUpdate do={
|
||||
/system/reboot;
|
||||
}
|
||||
|
||||
:local Interval [ $IfThenElse ([ :totime $PackagesUpdateDeferReboot ] >= 1d) \
|
||||
$PackagesUpdateDeferReboot 1d ];
|
||||
:local StartTime [ :tostr [ :totime (10800 + [ $GetRandomNumber 7200 ]) ] ];
|
||||
/system/scheduler/add name="_RebootForUpdate" start-time=$StartTime interval=$Interval \
|
||||
/system/scheduler/add name="_RebootForUpdate" start-time=$StartTime interval=1d \
|
||||
on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
|
||||
":global RebootForUpdate; \$RebootForUpdate;");
|
||||
$LogPrint info $ScriptName ("Scheduled reboot for update at " . $StartTime . \
|
||||
" local time (" . [ /system/clock/get time-zone-name ] . ")" . \
|
||||
[ $IfThenElse ($Interval > 1d) (" deferred by " . $Interval) ] . ".");
|
||||
" local time (" . [ /system/clock/get time-zone-name ] . ").");
|
||||
:return true;
|
||||
}
|
||||
|
||||
|
@ -159,7 +153,7 @@
|
|||
:error true;
|
||||
}
|
||||
} else={
|
||||
:if ($PackagesUpdateDeferReboot = true || [ :totime $PackagesUpdateDeferReboot ] >= 1d) do={
|
||||
:if ($PackagesUpdateDeferReboot = true) do={
|
||||
$Schedule $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue