mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
email-backup: use $SendEMail2
This drops $EmailBackupTo & $EmailBackupCc from settings! Use settings overwrite if required: :global EmailGeneralToOverride { "email-backup"="backup@example.com"; }
This commit is contained in:
parent
529cefffaf
commit
d2560db5c9
6 changed files with 15 additions and 23 deletions
|
@ -26,10 +26,8 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
* `BackupSendExport`: whether to send configuration export
|
* `BackupSendExport`: whether to send configuration export
|
||||||
* `BackupPassword`: password to encrypt the backup with
|
* `BackupPassword`: password to encrypt the backup with
|
||||||
* `BackupRandomDelay`: delay up to amount of seconds when run from scheduler
|
* `BackupRandomDelay`: delay up to amount of seconds when run from scheduler
|
||||||
* `EmailBackupTo`: e-mail address to send to
|
|
||||||
* `EmailBackupCc`: e-mail address(es) to send in copy
|
|
||||||
|
|
||||||
Also valid e-mail settings in `/ tool e-mail` are required to send mails.
|
Also valid e-mail settings are required to send mails.
|
||||||
|
|
||||||
Usage and invocation
|
Usage and invocation
|
||||||
--------------------
|
--------------------
|
||||||
|
|
17
email-backup
17
email-backup
|
@ -15,8 +15,6 @@
|
||||||
:global BackupSendBinary;
|
:global BackupSendBinary;
|
||||||
:global BackupSendExport;
|
:global BackupSendExport;
|
||||||
:global Domain;
|
:global Domain;
|
||||||
:global EmailBackupCc;
|
|
||||||
:global EmailBackupTo;
|
|
||||||
:global Identity;
|
:global Identity;
|
||||||
|
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
|
@ -25,6 +23,7 @@
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
:global ScriptFromTerminal;
|
:global ScriptFromTerminal;
|
||||||
|
:global SendEMail2;
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
|
@ -33,10 +32,6 @@
|
||||||
$LogPrintExit2 error $0 ("Configured to send neither backup nor config export.") true;
|
$LogPrintExit2 error $0 ("Configured to send neither backup nor config export.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :len $EmailBackupTo ] = 0) do={
|
|
||||||
$LogPrintExit2 error $0 ("Configuration is missing recipient for e-mail backup.") true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$WaitFullyConnected;
|
$WaitFullyConnected;
|
||||||
|
|
||||||
:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={
|
:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={
|
||||||
|
@ -71,11 +66,11 @@ $WaitFullyConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
# send email with status and files
|
# send email with status and files
|
||||||
/ tool e-mail send to=$EmailBackupTo cc=$EmailBackupCc \
|
$SendEMail2 ({ origin=$0; \
|
||||||
subject=("[" . $Identity . "] Backup & Config") \
|
subject=("Backup & Config"); \
|
||||||
body=("See attached files for backup and config export for " . \
|
message=("See attached files for backup and config export for " . \
|
||||||
$Identity . ".\n\n" . \
|
$Identity . ".\n\n" . \
|
||||||
[ $DeviceInfo ] . "\n\n" . \
|
[ $DeviceInfo ] . "\n\n" . \
|
||||||
"Backup file: " . $BackupFile . "\n" . \
|
"Backup file: " . $BackupFile . "\n" . \
|
||||||
"Config file: " . $ConfigFile) \
|
"Config file: " . $ConfigFile); \
|
||||||
file=$Attach;
|
attach=$Attach });
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
:global GlobalConfigVersion 48;
|
:global GlobalConfigVersion 49;
|
||||||
|
|
||||||
# This is used for DNS and backup file.
|
# This is used for DNS and backup file.
|
||||||
:global Domain "example.com";
|
:global Domain "example.com";
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
# TelegramTokenIdOverride and TelegramChatIdOverride like this:
|
# TelegramTokenIdOverride and TelegramChatIdOverride like this:
|
||||||
#:global EmailGeneralToOverride {
|
#:global EmailGeneralToOverride {
|
||||||
# "check-certificates"="override@example.com";
|
# "check-certificates"="override@example.com";
|
||||||
|
# "email-backup"="backup@example.com";
|
||||||
#}
|
#}
|
||||||
|
|
||||||
# Toggle this to disable symbols in notifications.
|
# Toggle this to disable symbols in notifications.
|
||||||
|
@ -50,9 +51,6 @@
|
||||||
:global BackupSendExport true;
|
:global BackupSendExport true;
|
||||||
:global BackupPassword "v3ry-s3cr3t";
|
:global BackupPassword "v3ry-s3cr3t";
|
||||||
:global BackupRandomDelay 0;
|
:global BackupRandomDelay 0;
|
||||||
# These addresses are used to send backup and config export files to.
|
|
||||||
:global EmailBackupTo "";
|
|
||||||
:global EmailBackupCc "";
|
|
||||||
# These credentials are used to upload backup and config export files.
|
# These credentials are used to upload backup and config export files.
|
||||||
# SFTP authentication is tricky, you may have to limit authentication
|
# SFTP authentication is tricky, you may have to limit authentication
|
||||||
# methods for your SSH server.
|
# methods for your SSH server.
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
# Comment or remove to disable news and change notifications.
|
# Comment or remove to disable news and change notifications.
|
||||||
:global GlobalConfigVersion 48;
|
:global GlobalConfigVersion 49;
|
||||||
|
|
||||||
# Copy configuration from global-config here and modify it.
|
# Copy configuration from global-config here and modify it.
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
46="Added configurable random delay in backup scripts to stretch execution and prevent resource congestion.";
|
46="Added configurable random delay in backup scripts to stretch execution and prevent resource congestion.";
|
||||||
47="Removed obsolete intermediate certificate 'Let's Encrypt Authority X3' from store.";
|
47="Removed obsolete intermediate certificate 'Let's Encrypt Authority X3' from store.";
|
||||||
48="Added support for overriding e-mail and Telegram settings for every script.";
|
48="Added support for overriding e-mail and Telegram settings for every script.";
|
||||||
|
49="Dropped '\$EmailBackupTo' & '\$EmailBackupCc' from configuration, use settings override if required.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Migration steps to be applied on script updates
|
# Migration steps to be applied on script updates
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||||
|
|
||||||
# expected configuration version
|
# expected configuration version
|
||||||
:global ExpectedConfigVersion 48;
|
:global ExpectedConfigVersion 49;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
Loading…
Reference in a new issue