mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-21 09:25:42 +02: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;
|
/file/add name=($FilePath . ".conf") contents=$Config;
|
||||||
$WaitForFile ($FilePath . ".conf");
|
$WaitForFile ($FilePath . ".conf");
|
||||||
|
|
||||||
|
:local Size [ :len $Config ];
|
||||||
|
:if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={
|
||||||
:do {
|
:do {
|
||||||
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
|
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
|
||||||
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
|
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
|
||||||
|
@ -113,6 +115,11 @@ $WaitFullyConnected;
|
||||||
:set ConfigFile "failed";
|
:set ConfigFile "failed";
|
||||||
:set Failed 1;
|
: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");
|
/file/remove ($FilePath . ".conf");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue