aboutsummaryrefslogtreecommitdiffstats
path: root/backup-email.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-24 19:38:56 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-29 08:58:50 +0200
commitffc7521a350e613c23507a1cdbc5a9b028beced1 (patch)
tree8cb922bdf7c06c8b7c5efe1963d262d590e467a3 /backup-email.rsc
parent3c96db58246ce85b9796f4322a7ace7687531b55 (diff)
backup-email: support indication of failure
Diffstat (limited to 'backup-email.rsc')
-rw-r--r--backup-email.rsc11
1 files changed, 9 insertions, 2 deletions
diff --git a/backup-email.rsc b/backup-email.rsc
index 4dd9fcc..8567a65 100644
--- a/backup-email.rsc
+++ b/backup-email.rsc
@@ -23,6 +23,7 @@
:global CharacterReplace;
:global DeviceInfo;
:global FormatLine;
+:global IfThenElse;
:global LogPrintExit2;
:global MkDir;
:global RandomDelay;
@@ -57,6 +58,7 @@ $WaitFullyConnected;
:local ExportFile "none";
:local ConfigFile "none";
:local Attach ({});
+:local Failed 0;
:if ([ $MkDir $DirName ] = false) do={
$LogPrintExit2 error $0 ("Failed creating directory!") true;
@@ -89,8 +91,9 @@ $WaitFullyConnected;
# send email with status and files
$SendEMail2 ({ origin=$0; \
- subject=([ $SymbolForNotification "floppy-disk,incoming-envelope" ] . \
- "Backup & Config"); \
+ subject=[ $IfThenElse ($Failed > 0) \
+ ([ $SymbolForNotification "floppy-disk,warning-sign" ] . "Backup & Config with failure") \
+ ([ $SymbolForNotification "floppy-disk,incoming-envelope" ] . "Backup & Config") ]; \
message=("See attached files for backup and config export for " . \
$Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
@@ -108,3 +111,7 @@ $SendEMail2 ({ origin=$0; \
:delay 1s;
:set I ($I + 1);
}
+
+:if ($Failed = 1) do={
+ :error "An error occured!";
+}