This commit is contained in:
Grzegorz Budny 2020-03-15 19:41:05 +01:00
parent ff04ad34f2
commit 2f897350bc
2 changed files with 54 additions and 10 deletions

View file

@ -1,26 +1,40 @@
# RouterOS Function
# Copyright (c) Grzegorz Budny
# Version 1.1
# Last update: 2/14/2020
# Version 1.2
# Last update: 3/15/2020
# Creates new backup file and uploads it to MikroTik Cloud
:global CloudBackup do={
:local systemLicense [/system license get value-name=level];
:local systemName [/system identity get value-name=name];
:local backupNumber [/system backup cloud print count-only];
:if ($currentLicenseLevel != "free") do={
:if ($backupNumber = 0) do={
:log info "...:::License allows cloud backup, process started:::..."
:log info "...:::No Cloud Backup Present!:::...";
:log info "...:::Cloud backup process started:::...";
/system backup cloud upload-file action=create-and-upload file=cloudBackup.backup password=password
/system backup cloud upload-file action=create-and-upload name=$systemName password=$password;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=($systemName." cloud backup created.") body=($systemName." created MikroTik cloud backup.");
:log info "...:::Cloud Backup Created:::...";
}
:if ($backupNumber > 0) do={
:log warning "...:::Cloud Backup Present!:::...";
:log info "...:::Cloud backup process started:::...";
:log warning "...:::Removing current slot!:::...";
/system backup cloud remove-file 0;
:log warning "...:::Slot removed:::...";
:log info "...:::Cloud backup process started:::...";
/system backup cloud upload-file action=create-and-upload name=$systemName password=$password;
:log info "...:::Cloud Backup Created:::...";
}
}
$CloudBackup smtpServer=smtpServer smtpPort=smtpPort domain=@example.com recipient=recipient@example.com;
$CloudBackup password=password