email-backup: be more verbose about attached files and secret key

This commit is contained in:
Christian Hesse 2019-01-09 15:06:01 +01:00
parent fe34a80a3d
commit 57d93aa701

View file

@ -22,6 +22,8 @@
# filename based on identity # filename based on identity
:local FileName ($Identity . "." . $Domain); :local FileName ($Identity . "." . $Domain);
:local CloudStatus $BackupCloud; :local CloudStatus $BackupCloud;
:local BackupStatus $BackupSendBinary;
:local ConfigStatus $BackupSendExport;
:local Attach [ :toarray "" ]; :local Attach [ :toarray "" ];
# get some system information # get some system information
@ -37,7 +39,8 @@
# attach to mail # attach to mail
:if ($BackupSendBinary = true) do={ :if ($BackupSendBinary = true) do={
:set Attach ($Attach, ($FileName . ".backup")); :set BackupStatus ($FileName . ".backup");
:set Attach ($Attach, $BackupStatus);
} }
# upload to cloud # upload to cloud
@ -50,6 +53,7 @@
/ system backup cloud remove-file [ find ]; / system backup cloud remove-file [ find ];
} }
/ system backup cloud upload-file action=upload src-file=($FileName . ".backup"); / system backup cloud upload-file action=upload src-file=($FileName . ".backup");
:set CloudStatus [ / system backup cloud get [ find ] secret-download-key ];
} on-error={ } on-error={
:set CloudStatus "failed"; :set CloudStatus "failed";
} }
@ -59,7 +63,8 @@
# create configuration export # create configuration export
:if ($BackupSendExport = true) do={ :if ($BackupSendExport = true) do={
/ export terse file=$FileName; / export terse file=$FileName;
:set Attach ($Attach, ($FileName . ".rsc")); :set ConfigStatus ($FileName . ".rsc");
:set Attach ($Attach, $ConfigStatus);
} }
# send email with status and files # send email with status and files
@ -71,8 +76,8 @@
"Hostname: " . $Identity . "\n" . \ "Hostname: " . $Identity . "\n" . \
"Channel: " . $Channel . "\n" . \ "Channel: " . $Channel . "\n" . \
"RouterOS: " . $InstalledVersion . "\n\n" . \ "RouterOS: " . $InstalledVersion . "\n\n" . \
"Backup attached: " . $BackupSendBinary . "\n" . \ "Backup attached: " . $BackupStatus . "\n" . \
"Config attached: " . $BackupSendExport . "\n" . \ "Config attached: " . $ConfigStatus . "\n" . \
"Cloud backup: " . $CloudStatus) \ "Cloud backup: " . $CloudStatus) \
file=$Attach; file=$Attach;
} }