mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-20 16:09: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
|
||||
# https://rsc.eworm.de/doc/check-perpetual-license.md
|
||||
|
||||
:local ExitOK false;
|
||||
:onerror Err {
|
||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||
|
|
@ -25,8 +24,7 @@
|
|||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
:exit;
|
||||
}
|
||||
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -34,8 +32,7 @@
|
|||
:local License [ /system/license/get ];
|
||||
:if ([ :typeof ($License->"deadline-at") ] != "str") do={
|
||||
$LogPrint info $ScriptName ("This device does not have a perpetual license.");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
:exit;
|
||||
}
|
||||
|
||||
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
|
||||
|
|
@ -47,8 +44,7 @@
|
|||
", can no longer update RouterOS on " . $Identity . "...") });
|
||||
:set SentCertificateNotification "expired";
|
||||
}
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
:exit;
|
||||
}
|
||||
|
||||
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
|
||||
|
|
@ -60,8 +56,7 @@
|
|||
($License->"deadline-at") . " on " . $Identity . "...") });
|
||||
:set SentCertificateNotification "warning";
|
||||
}
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
:exit;
|
||||
}
|
||||
|
||||
:if ([ :typeof $SentCertificateNotification ] = "str" && \
|
||||
|
|
@ -74,5 +69,5 @@
|
|||
:set SentCertificateNotification;
|
||||
}
|
||||
} do={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
||||
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue