aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-07-17 12:00:59 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-07-17 12:00:59 +0200
commit8eaf24e27415ad56138cf2ec93eb850509e42b0c (patch)
treeeb9eaf1764c54e2c002a7af5e87dad3330743695
parent3e1746f43e624ebfa9e10fc46ab9d170956612cc (diff)
downloadrouteros-scripts-8eaf24e27415ad56138cf2ec93eb850509e42b0c.tar.gz
routeros-scripts-8eaf24e27415ad56138cf2ec93eb850509e42b0c.tar.zst
upload-backup: change symbol to warning sign on failure
-rw-r--r--upload-backup6
1 files changed, 5 insertions, 1 deletions
diff --git a/upload-backup b/upload-backup
index 6ad85ad..8d7dd28 100644
--- a/upload-backup
+++ b/upload-backup
@@ -17,6 +17,7 @@
:global CharacterReplace;
:global DeviceInfo;
+:global IfThenElse;
:global LogPrintExit;
:global SendNotification;
:global SymbolForNotification;
@@ -30,6 +31,7 @@
:local FileName [ $CharacterReplace ($Identity . "." . $Domain) "." "_" ];
:local BackupFile "none";
:local ConfigFile "none";
+:local Failed 0;
# binary backup
:if ($BackupSendBinary = true) do={
@@ -42,6 +44,7 @@
} on-error={
$LogPrintExit error ("Uploading backup file failed!") false;
:set BackupFile "failed";
+ :set Failed 1;
}
}
@@ -56,10 +59,11 @@
} on-error={
$LogPrintExit error ("Uploading configuration export failed!") false;
:set ConfigFile "failed";
+ :set Failed 1;
}
}
-$SendNotification ([ $SymbolForNotification "floppy-disk" ] . "Backup & Config Upload") \
+$SendNotification ([ $SymbolForNotification [ $IfThenElse ($Failed > 0) "warning-sign" "floppy-disk" ] ] . "Backup & Config Upload") \
("Backup and config export upload for " . $Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
"Backup file: " . $BackupFile . "\n" . \