From fe04b8b8db3040d739e9151207dfcf75de1852af Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 2 Jan 2019 22:35:34 +0100 Subject: rename script 'check-lte-firmware-update' -> 'check-lte-firmware-upgrade' That's the correct wording from commands.. --- check-lte-firmware-update | 34 ---------------------------------- check-lte-firmware-upgrade | 34 ++++++++++++++++++++++++++++++++++ global-config | 2 +- 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 check-lte-firmware-update create mode 100644 check-lte-firmware-upgrade diff --git a/check-lte-firmware-update b/check-lte-firmware-update deleted file mode 100644 index a228b93..0000000 --- a/check-lte-firmware-update +++ /dev/null @@ -1,34 +0,0 @@ -#!rsc -# RouterOS script: check-lte-firmware-update -# Copyright (c) 2018-2019 Christian Hesse -# -# check for LTE firmware update, send notification e-mails - -:global "identity"; -:global "sent-lte-firmware-update-notification"; - -:global SendNotification; - -:foreach interface in=[ / interface lte find ] do={ - :local intname [ / interface lte get $interface name ]; - :do { - :local firmware [ / interface lte firmware-upgrade $interface once as-value ]; - # strip the extra line break (TODO: remove when fixed upstream) - :set ($firmware->"latest") [ :pick ($firmware->"latest") 0 [ :find ($firmware->"latest") "\n" ] ]; - - :if ($"sent-lte-firmware-update-notification" = ($firmware->"latest")) do={ - :log debug ("Already sent the LTE firmware update notification for version " . \ - ($firmware->"latest") . "."); - } else={ - :if (($firmware->"installed") != ($firmware->"latest")) do={ - $SendNotification ("LTE firmware update notification") \ - ("A new firmware version " . ($firmware->"latest") . " is available for " . \ - "LTE interface " . $intname . " on " . $identity . "."); - :set "sent-lte-firmware-update-notification" ($firmware->"latest"); - } - } - } on-error={ - :log debug ("Could not get latest LTE firmware version for interface " . \ - $intname . "."); - } -} diff --git a/check-lte-firmware-upgrade b/check-lte-firmware-upgrade new file mode 100644 index 0000000..c99f5d7 --- /dev/null +++ b/check-lte-firmware-upgrade @@ -0,0 +1,34 @@ +#!rsc +# RouterOS script: check-lte-firmware-upgrade +# Copyright (c) 2018-2019 Christian Hesse +# +# check for LTE firmware upgrade, send notification e-mails + +:global "identity"; +:global "sent-lte-firmware-upgrade-notification"; + +:global SendNotification; + +:foreach interface in=[ / interface lte find ] do={ + :local intname [ / interface lte get $interface name ]; + :do { + :local firmware [ / interface lte firmware-upgrade $interface once as-value ]; + # strip the extra line break (TODO: remove when fixed upstream) + :set ($firmware->"latest") [ :pick ($firmware->"latest") 0 [ :find ($firmware->"latest") "\n" ] ]; + + :if ($"sent-lte-firmware-upgrade-notification" = ($firmware->"latest")) do={ + :log debug ("Already sent the LTE firmware upgrade notification for version " . \ + ($firmware->"latest") . "."); + } else={ + :if (($firmware->"installed") != ($firmware->"latest")) do={ + $SendNotification ("LTE firmware upgrade notification") \ + ("A new firmware version " . ($firmware->"latest") . " is available for " . \ + "LTE interface " . $intname . " on " . $identity . "."); + :set "sent-lte-firmware-upgrade-notification" ($firmware->"latest"); + } + } + } on-error={ + :log debug ("Could not get latest LTE firmware version for interface " . \ + $intname . "."); + } +} diff --git a/global-config b/global-config index cba5e27..6e32e7f 100644 --- a/global-config +++ b/global-config @@ -104,6 +104,6 @@ # Do *NOT* change these! :global "sent-routeros-update-notification" "-"; -:global "sent-lte-firmware-update-notification" "-"; +:global "sent-lte-firmware-upgrade-notification" "-"; :global "identity" [ / system identity get name ]; / system script run global-functions; -- cgit v1.2.3-54-g00ecf