mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-01 08:44:32 +02:00
backup-email: check configuration size before writing file
This commit is contained in:
parent
f86cf27aa3
commit
1e247542a5
1 changed files with 6 additions and 5 deletions
|
@ -83,15 +83,16 @@ $WaitFullyConnected;
|
||||||
# global-config-overlay
|
# global-config-overlay
|
||||||
:if ($BackupSendGlobalConfig = true) do={
|
:if ($BackupSendGlobalConfig = true) do={
|
||||||
:local Config [ /system/script/get global-config-overlay source ];
|
:local Config [ /system/script/get global-config-overlay source ];
|
||||||
/file/add name=($FilePath . ".conf") contents=$Config;
|
|
||||||
$WaitForFile ($FilePath . ".conf");
|
|
||||||
|
|
||||||
:local Size [ :len $Config ];
|
:local Size [ :len $Config ];
|
||||||
:if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={
|
|
||||||
|
:if ($Size <= 4095) {
|
||||||
|
/file/add name=($FilePath . ".conf") contents=$Config;
|
||||||
|
$WaitForFile ($FilePath . ".conf");
|
||||||
:set ConfigFile ($FileName . ".conf");
|
:set ConfigFile ($FileName . ".conf");
|
||||||
:set Attach ($Attach, ($FilePath . ".conf"));
|
:set Attach ($Attach, ($FilePath . ".conf"));
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit2 warning $0 ("Creating config file failed. Size should be " . $Size . " bytes, but is not.") false;
|
$LogPrintExit2 warning $0 ("Creating config file not possible. Limit is 4kB, configuration has " . \
|
||||||
|
$Size . " bytes.") false;
|
||||||
:set ConfigFile "failed";
|
:set ConfigFile "failed";
|
||||||
:set Failed 1;
|
:set Failed 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue