aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-04-29 16:26:31 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-04-29 22:37:36 +0200
commitd2560db5c96b5e2679178fd4f6595af89cab0801 (patch)
tree0b15c70107c7c68c5789d3cdc5f251867be68bba
parent529cefffafca2dedd93f48303db73805d965431f (diff)
email-backup: use $SendEMail2change-49
This drops $EmailBackupTo & $EmailBackupCc from settings! Use settings overwrite if required: :global EmailGeneralToOverride { "email-backup"="backup@example.com"; }
-rw-r--r--doc/email-backup.md4
-rw-r--r--email-backup23
-rw-r--r--global-config6
-rw-r--r--global-config-overlay2
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
6 files changed, 15 insertions, 23 deletions
diff --git a/doc/email-backup.md b/doc/email-backup.md
index 4b769ec..7076691 100644
--- a/doc/email-backup.md
+++ b/doc/email-backup.md
@@ -26,10 +26,8 @@ The configuration goes to `global-config-overlay`, these are the parameters:
* `BackupSendExport`: whether to send configuration export
* `BackupPassword`: password to encrypt the backup with
* `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
--------------------
diff --git a/email-backup b/email-backup
index e9a75cd..0ba4d45 100644
--- a/email-backup
+++ b/email-backup
@@ -15,8 +15,6 @@
:global BackupSendBinary;
:global BackupSendExport;
:global Domain;
-:global EmailBackupCc;
-:global EmailBackupTo;
:global Identity;
:global CharacterReplace;
@@ -25,6 +23,7 @@
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
+:global SendEMail2;
:global WaitForFile;
:global WaitFullyConnected;
@@ -33,10 +32,6 @@
$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;
:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={
@@ -71,11 +66,11 @@ $WaitFullyConnected;
}
# send email with status and files
-/ tool e-mail send to=$EmailBackupTo cc=$EmailBackupCc \
- subject=("[" . $Identity . "] Backup & Config") \
- body=("See attached files for backup and config export for " . \
- $Identity . ".\n\n" . \
- [ $DeviceInfo ] . "\n\n" . \
- "Backup file: " . $BackupFile . "\n" . \
- "Config file: " . $ConfigFile) \
- file=$Attach;
+$SendEMail2 ({ origin=$0; \
+ subject=("Backup & Config"); \
+ message=("See attached files for backup and config export for " . \
+ $Identity . ".\n\n" . \
+ [ $DeviceInfo ] . "\n\n" . \
+ "Backup file: " . $BackupFile . "\n" . \
+ "Config file: " . $ConfigFile); \
+ attach=$Attach });
diff --git a/global-config b/global-config
index 9e69c18..25d0496 100644
--- a/global-config
+++ b/global-config
@@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
-:global GlobalConfigVersion 48;
+:global GlobalConfigVersion 49;
# This is used for DNS and backup file.
:global Domain "example.com";
@@ -38,6 +38,7 @@
# TelegramTokenIdOverride and TelegramChatIdOverride like this:
#:global EmailGeneralToOverride {
# "check-certificates"="override@example.com";
+# "email-backup"="backup@example.com";
#}
# Toggle this to disable symbols in notifications.
@@ -50,9 +51,6 @@
:global BackupSendExport true;
:global BackupPassword "v3ry-s3cr3t";
: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.
# SFTP authentication is tricky, you may have to limit authentication
# methods for your SSH server.
diff --git a/global-config-overlay b/global-config-overlay
index 316fde5..7057765 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
# Comment or remove to disable news and change notifications.
-:global GlobalConfigVersion 48;
+:global GlobalConfigVersion 49;
# Copy configuration from global-config here and modify it.
diff --git a/global-config.changes b/global-config.changes
index d3d1059..61850dd 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -52,6 +52,7 @@
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.";
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
diff --git a/global-functions b/global-functions
index a1a070c..699b0fe 100644
--- a/global-functions
+++ b/global-functions
@@ -8,7 +8,7 @@
# https://git.eworm.de/cgit/routeros-scripts/about/
# expected configuration version
-:global ExpectedConfigVersion 48;
+:global ExpectedConfigVersion 49;
# global variables not to be changed by user
:global GlobalFunctionsReady false;