mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-21 00:19:32 +00:00
check-perpetual-license: early exit with :exit
This commit is contained in:
parent
9e1e6c8a93
commit
f3e2693b5c
1 changed files with 5 additions and 10 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
# 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 ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue