mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-10 05:04:47 +02:00
check-routeros-update: send certificate warning just once...
... and another one once expired.
This commit is contained in:
parent
f8c3659f6a
commit
6909514692
1 changed files with 15 additions and 8 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,26 @@
|
||||||
: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") . "!");
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
:if ($SentCertificateNotification != "expired") do={
|
||||||
subject=([ $SymbolForNotification "warning-sign" ] . "License expired!"); \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
message=("Your license expired on " . ($License->"deadline-at") . \
|
subject=([ $SymbolForNotification "warning-sign" ] . "License expired!"); \
|
||||||
", can no longer update RouterOS on " . $Identity . "...") });
|
message=("Your license expired on " . ($License->"deadline-at") . \
|
||||||
|
", 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") . "!");
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
:if ($SentCertificateNotification != "warning") do={
|
||||||
subject=([ $SymbolForNotification "warning-sign" ] . "License about to expire!"); \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
message=("Your license failed to renew and is about to expire on " . \
|
subject=([ $SymbolForNotification "warning-sign" ] . "License about to expire!"); \
|
||||||
($License->"deadline-at") . " on " . $Identity . "...") });
|
message=("Your license failed to renew and is about to expire on " . \
|
||||||
|
($License->"deadline-at") . " on " . $Identity . "...") });
|
||||||
|
:set SentCertificateNotification "warning";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue