mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
backup-email: support sending global-config-overlay
This commit is contained in:
parent
48bf54644a
commit
0527503c8e
1 changed files with 13 additions and 1 deletions
14
backup-email
14
backup-email
|
@ -16,6 +16,7 @@
|
||||||
:global BackupRandomDelay;
|
:global BackupRandomDelay;
|
||||||
:global BackupSendBinary;
|
:global BackupSendBinary;
|
||||||
:global BackupSendExport;
|
:global BackupSendExport;
|
||||||
|
:global BackupSendGlobalConfig;
|
||||||
:global Domain;
|
:global Domain;
|
||||||
:global Identity;
|
:global Identity;
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ $WaitFullyConnected;
|
||||||
:local FileName [ $CharacterReplace ($Identity . "." . $Domain) "." "_" ];
|
:local FileName [ $CharacterReplace ($Identity . "." . $Domain) "." "_" ];
|
||||||
:local FilePath ($DirName . "/" . $FileName);
|
:local FilePath ($DirName . "/" . $FileName);
|
||||||
:local BackupFile "none";
|
:local BackupFile "none";
|
||||||
|
:local ExportFile "none";
|
||||||
:local ConfigFile "none";
|
:local ConfigFile "none";
|
||||||
:local Attach ({});
|
:local Attach ({});
|
||||||
|
|
||||||
|
@ -69,10 +71,19 @@ $WaitFullyConnected;
|
||||||
:if ($BackupSendExport = true) do={
|
:if ($BackupSendExport = true) do={
|
||||||
/export terse show-sensitive file=$FilePath;
|
/export terse show-sensitive file=$FilePath;
|
||||||
$WaitForFile ($FilePath . ".rsc");
|
$WaitForFile ($FilePath . ".rsc");
|
||||||
:set ConfigFile ($FileName . ".rsc");
|
:set ExportFile ($FileName . ".rsc");
|
||||||
:set Attach ($Attach, ($FilePath . ".rsc"));
|
:set Attach ($Attach, ($FilePath . ".rsc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# global-config-overlay
|
||||||
|
:if ($BackupSendGlobalConfig = true) do={
|
||||||
|
:execute script={ / } file=($FilePath . ".conf");
|
||||||
|
$WaitForFile ($FilePath . ".conf.txt");
|
||||||
|
/file/set ($FilePath . ".conf.txt") contents=[ /system/script/get global-config-overlay source ];
|
||||||
|
:set ConfigFile ($FileName . ".conf.txt");
|
||||||
|
:set Attach ($Attach, ($FilePath . ".conf.txt"));
|
||||||
|
}
|
||||||
|
|
||||||
# send email with status and files
|
# send email with status and files
|
||||||
$SendEMail2 ({ origin=$0; \
|
$SendEMail2 ({ origin=$0; \
|
||||||
subject=([ $SymbolForNotification "floppy-disk,incoming-envelope" ] . \
|
subject=([ $SymbolForNotification "floppy-disk,incoming-envelope" ] . \
|
||||||
|
@ -81,6 +92,7 @@ $SendEMail2 ({ origin=$0; \
|
||||||
$Identity . ".\n\n" . \
|
$Identity . ".\n\n" . \
|
||||||
[ $DeviceInfo ] . "\n\n" . \
|
[ $DeviceInfo ] . "\n\n" . \
|
||||||
"Backup file: " . $BackupFile . "\n" . \
|
"Backup file: " . $BackupFile . "\n" . \
|
||||||
|
"Export file: " . $ExportFile . "\n" . \
|
||||||
"Config file: " . $ConfigFile); \
|
"Config file: " . $ConfigFile); \
|
||||||
attach=$Attach; remove-attach=true });
|
attach=$Attach; remove-attach=true });
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue