mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-09 20:54:34 +02:00
backup-email: support indication of failure
This commit is contained in:
parent
3c96db5824
commit
ffc7521a35
1 changed files with 9 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
:global FormatLine;
|
:global FormatLine;
|
||||||
|
:global IfThenElse;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
|
@ -57,6 +58,7 @@ $WaitFullyConnected;
|
||||||
:local ExportFile "none";
|
:local ExportFile "none";
|
||||||
:local ConfigFile "none";
|
:local ConfigFile "none";
|
||||||
:local Attach ({});
|
:local Attach ({});
|
||||||
|
:local Failed 0;
|
||||||
|
|
||||||
:if ([ $MkDir $DirName ] = false) do={
|
:if ([ $MkDir $DirName ] = false) do={
|
||||||
$LogPrintExit2 error $0 ("Failed creating directory!") true;
|
$LogPrintExit2 error $0 ("Failed creating directory!") true;
|
||||||
|
@ -89,8 +91,9 @@ $WaitFullyConnected;
|
||||||
|
|
||||||
# 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=[ $IfThenElse ($Failed > 0) \
|
||||||
"Backup & Config"); \
|
([ $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 " . \
|
message=("See attached files for backup and config export for " . \
|
||||||
$Identity . ".\n\n" . \
|
$Identity . ".\n\n" . \
|
||||||
[ $DeviceInfo ] . "\n\n" . \
|
[ $DeviceInfo ] . "\n\n" . \
|
||||||
|
@ -108,3 +111,7 @@ $SendEMail2 ({ origin=$0; \
|
||||||
:delay 1s;
|
:delay 1s;
|
||||||
:set I ($I + 1);
|
:set I ($I + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:if ($Failed = 1) do={
|
||||||
|
:error "An error occured!";
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue