-
Notifications
You must be signed in to change notification settings - Fork 2
/
RouterOS_Auto_Firmware_Upgrade.rsc
33 lines (23 loc) · 1.08 KB
/
RouterOS_Auto_Firmware_Upgrade.rsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# RouterOS Fucntion
# Copyright (c) Grzegorz Budny
# Version 1.0
# Last update: 2/8/2020
# Checks if latest firmware is available. Installs it and sends email notification
:global AutoFirmwareUpgrade do={
:local currentFirmware [system routerboard get current-firmware];
:local upgradeFirmware [system routerboard get upgrade-firmware];
:local systemName [/system identity get value-name=name];
:if ($currentFirmware != $upgradeFirmware) do={
:log info ("...:::New firmware version found. Upgrading from ".$currentFirmware." to ".$upgradeFirmware.":::...");
/system routerboard upgrade;
:delay 2;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=("Update available on ".$systemName) \
body=($systemName." is upgrading to ".$upgradeFirmware.". \
\nfirmware version. System is rebooting.");
:delay 2;
/system reboot;
}
}
$AutoFirmwareUpgrade smtpServer=smtpServer smtpPort=smtpPort domain=example.com \