Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2097591244 | ||
|
|
4e446e5f8d |
1 changed files with 24 additions and 7 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
:global SafeUpdateNeighborIdentity;
|
:global SafeUpdateNeighborIdentity;
|
||||||
:global SafeUpdatePatch;
|
:global SafeUpdatePatch;
|
||||||
:global SafeUpdateUrl;
|
:global SafeUpdateUrl;
|
||||||
|
:global SentCertificateNotification;
|
||||||
:global SentRouterosUpdateNotification;
|
:global SentRouterosUpdateNotification;
|
||||||
|
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
|
|
@ -70,20 +71,36 @@
|
||||||
:if ([ :typeof ($License->"deadline-at") ] = "str") do={
|
:if ([ :typeof ($License->"deadline-at") ] = "str") do={
|
||||||
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
|
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
|
||||||
$LogPrint warning $ScriptName ("Your license expired on " . ($License->"deadline-at") . "!");
|
$LogPrint warning $ScriptName ("Your license expired on " . ($License->"deadline-at") . "!");
|
||||||
|
:if ($SentCertificateNotification != "expired") do={
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "warning-sign" ] . "License expired!"); \
|
subject=([ $SymbolForNotification "warning-sign" ] . "License expired!"); \
|
||||||
message=("Your license expired on " . ($License->"deadline-at") . \
|
message=("Your license expired on " . ($License->"deadline-at") . \
|
||||||
", can no longer update RouterOS on " . $Identity . "...") });
|
", can no longer update RouterOS on " . $Identity . "...") });
|
||||||
|
:set SentCertificateNotification "expired";
|
||||||
|
}
|
||||||
:set ExitOK true;
|
:set ExitOK true;
|
||||||
:error false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
|
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
|
||||||
$LogPrint warning $ScriptName ("Your license will expire on " . ($License->"deadline-at") . "!");
|
$LogPrint warning $ScriptName ("Your license will expire on " . ($License->"deadline-at") . "!");
|
||||||
|
:if ($SentCertificateNotification != "warning") do={
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "warning-sign" ] . "License about to expire!"); \
|
subject=([ $SymbolForNotification "warning-sign" ] . "License about to expire!"); \
|
||||||
message=("Your license failed to renew and is about to expire on " . \
|
message=("Your license failed to renew and is about to expire on " . \
|
||||||
($License->"deadline-at") . " on " . $Identity . "...") });
|
($License->"deadline-at") . " on " . $Identity . "...") });
|
||||||
|
:set SentCertificateNotification "warning";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:if ([ :typeof $SentCertificateNotification ] = "str" && \
|
||||||
|
[ :totime ($License->"deadline-at") ] - 3w > [ :timestamp ]) do={
|
||||||
|
$LogPrint info $ScriptName ("Your license was successfully renewed.");
|
||||||
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
|
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "License renewed"); \
|
||||||
|
message=("Your license was successfully renewed on " . $Identity . \
|
||||||
|
". It is now valid until " . ($License->"deadline-at") . ".") });
|
||||||
|
:set SentCertificateNotification;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue