mirror of
https://github.com/nymurbd/MikroTik-scripts.git
synced 2025-07-10 18:14:29 +02:00
check-routeros-update: resend notification if version changes
This commit is contained in:
parent
21f2b04f9a
commit
23b167e84b
2 changed files with 10 additions and 12 deletions
|
@ -16,21 +16,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ($"sent-routeros-update-notification" = true) do={
|
|
||||||
:error "Already sent the RouterOS update notification.";
|
|
||||||
}
|
|
||||||
|
|
||||||
# get some information
|
|
||||||
:local model [ / system routerboard get model ];
|
|
||||||
:local serialnumber [ / system routerboard get serial-number ];
|
|
||||||
|
|
||||||
# check for RouterOS
|
|
||||||
/ system package update check-for-updates without-paging;
|
/ system package update check-for-updates without-paging;
|
||||||
:local installedversion [ / system package update get installed-version ];
|
:local installedversion [ / system package update get installed-version ];
|
||||||
:local latestversion [ / system package update get latest-version ];
|
:local latestversion [ / system package update get latest-version ];
|
||||||
:local channel [ / system package update get channel ];
|
|
||||||
|
:if ($"sent-routeros-update-notification" = $latestversion) do={
|
||||||
|
:error ("Already sent the RouterOS update notification for version" . $latestversion . ".");
|
||||||
|
}
|
||||||
|
|
||||||
:if ($installedversion != $latestversion) do={
|
:if ($installedversion != $latestversion) do={
|
||||||
|
:local channel [ / system package update get channel ];
|
||||||
|
:local model [ / system routerboard get model ];
|
||||||
|
:local serialnumber [ / system routerboard get serial-number ];
|
||||||
|
|
||||||
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \
|
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \
|
||||||
subject=("[" . $identity . "] RouterOS update notification") \
|
subject=("[" . $identity . "] RouterOS update notification") \
|
||||||
body=("There is a RouterOS update available\n\n" . \
|
body=("There is a RouterOS update available\n\n" . \
|
||||||
|
@ -40,5 +38,5 @@
|
||||||
"Channel: " . $channel . "\n" . \
|
"Channel: " . $channel . "\n" . \
|
||||||
"Installed: " . $installedversion . "\n" . \
|
"Installed: " . $installedversion . "\n" . \
|
||||||
"Available: " . $latestversion);
|
"Available: " . $latestversion);
|
||||||
:set "sent-routeros-update-notification" true;
|
:set "sent-routeros-update-notification" $latestversion;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,5 @@
|
||||||
:global "script-updates-ignore" { "global-config"; "GeneratePSK" };
|
:global "script-updates-ignore" { "global-config"; "GeneratePSK" };
|
||||||
|
|
||||||
# Do *NOT* change these!
|
# Do *NOT* change these!
|
||||||
:global "sent-routeros-update-notification" false;
|
:global "sent-routeros-update-notification" "-";
|
||||||
:global "identity" [ / system identity get name ];
|
:global "identity" [ / system identity get name ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue