mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-16 18:19:36 +00:00
check-perpetual-license: early exit with :exit
This commit is contained in:
parent
8bd9c65c2d
commit
76884cd4d8
2 changed files with 7 additions and 12 deletions
|
|
@ -3,12 +3,11 @@
|
||||||
# Copyright (c) 2025-2026 Christian Hesse <mail@eworm.de>
|
# Copyright (c) 2025-2026 Christian Hesse <mail@eworm.de>
|
||||||
# https://rsc.eworm.de/COPYING.md
|
# https://rsc.eworm.de/COPYING.md
|
||||||
#
|
#
|
||||||
# requires RouterOS, version=7.19
|
# requires RouterOS, version=7.22
|
||||||
#
|
#
|
||||||
# check perpetual license on CHR
|
# check perpetual license on CHR
|
||||||
# https://rsc.eworm.de/doc/check-perpetual-license.md
|
# https://rsc.eworm.de/doc/check-perpetual-license.md
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -25,8 +24,7 @@
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$WaitFullyConnected;
|
$WaitFullyConnected;
|
||||||
|
|
@ -34,8 +32,7 @@
|
||||||
:local License [ /system/license/get ];
|
:local License [ /system/license/get ];
|
||||||
:if ([ :typeof ($License->"deadline-at") ] != "str") do={
|
:if ([ :typeof ($License->"deadline-at") ] != "str") do={
|
||||||
$LogPrint info $ScriptName ("This device does not have a perpetual license.");
|
$LogPrint info $ScriptName ("This device does not have a perpetual license.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
|
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
|
||||||
|
|
@ -47,8 +44,7 @@
|
||||||
", can no longer update RouterOS on " . $Identity . "...") });
|
", can no longer update RouterOS on " . $Identity . "...") });
|
||||||
:set SentCertificateNotification "expired";
|
:set SentCertificateNotification "expired";
|
||||||
}
|
}
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
|
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
|
||||||
|
|
@ -60,8 +56,7 @@
|
||||||
($License->"deadline-at") . " on " . $Identity . "...") });
|
($License->"deadline-at") . " on " . $Identity . "...") });
|
||||||
:set SentCertificateNotification "warning";
|
:set SentCertificateNotification "warning";
|
||||||
}
|
}
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $SentCertificateNotification ] = "str" && \
|
:if ([ :typeof $SentCertificateNotification ] = "str" && \
|
||||||
|
|
@ -74,5 +69,5 @@
|
||||||
:set SentCertificateNotification;
|
:set SentCertificateNotification;
|
||||||
}
|
}
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitOnError; $ExitOnError [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Check perpetual license on CHR
|
||||||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||||
[](https://mikrotik.com/download/changelogs/)
|
[](https://mikrotik.com/download/changelogs/)
|
||||||
[](https://t.me/routeros_scripts)
|
[](https://t.me/routeros_scripts)
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue