Skip to content

Commit 431eb6b

Browse files
committed
Add script for automatic upgrade
1 parent 56b1740 commit 431eb6b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/tool e-mail
2+
set address=10.0.0.1 from=mikrotik@example.com password=xxx port=587 start-tls=yes user=mikrotik@example.com
3+
4+
/system scheduler
5+
add interval=1w name=backup on-event="/system script run upgrade" start-date=jan/01/2000 start-time=22:00:00

automatic-upgrade/upgrade.rsc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:local recipient "mikrotik@example.com"
2+
:local identity [/system identity get name]
3+
4+
/system package update check-for-update
5+
:delay 5
6+
7+
:local current [/system package update get installed-version]
8+
:local latest [/system package update get latest-version]
9+
10+
:if ([:tostr $latest] != "" && $current != $latest) do={
11+
:local mailbody ("Identity: " . $identity . "\r\nBoard name: " . [/system resource get board-name] . "\r\nSerial number: " . [/system routerboard get serial-number] . "\r\nFrom version: " . $current . "\r\nTo version: " . $latest)
12+
/tool e-mail send to=$recipient subject=($identity . " - RouterOS has been upgraded") body=$mailbody
13+
/system package update install
14+
}

0 commit comments

Comments
 (0)