mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
backup-upload: detect failure creating config file
This commit is contained in:
parent
07c6f5836a
commit
f86cf27aa3
1 changed files with 13 additions and 6 deletions
|
@ -104,6 +104,8 @@ $WaitFullyConnected;
|
|||
/file/add name=($FilePath . ".conf") contents=$Config;
|
||||
$WaitForFile ($FilePath . ".conf");
|
||||
|
||||
:local Size [ :len $Config ];
|
||||
:if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={
|
||||
:do {
|
||||
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
|
||||
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
|
||||
|
@ -113,6 +115,11 @@ $WaitFullyConnected;
|
|||
:set ConfigFile "failed";
|
||||
:set Failed 1;
|
||||
}
|
||||
} else={
|
||||
$LogPrintExit2 warning $0 ("Creating config file failed. Size should be " . $Size . " bytes, but is not.") false;
|
||||
:set ConfigFile "failed";
|
||||
:set Failed 1;
|
||||
}
|
||||
|
||||
/file/remove ($FilePath . ".conf");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue