aboutsummaryrefslogtreecommitdiffstats
path: root/backup-email.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-24 19:39:38 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-29 08:58:50 +0200
commit07c6f5836a7e56d310890cf4bdaba1854205420f (patch)
tree6b73f97072d8cc9902231cca10ccf33be0d13ebc /backup-email.rsc
parentffc7521a350e613c23507a1cdbc5a9b028beced1 (diff)
backup-email: detect failure creating config file
Diffstat (limited to 'backup-email.rsc')
-rw-r--r--backup-email.rsc12
1 files changed, 10 insertions, 2 deletions
diff --git a/backup-email.rsc b/backup-email.rsc
index 8567a65..3dce2ca 100644
--- a/backup-email.rsc
+++ b/backup-email.rsc
@@ -85,8 +85,16 @@ $WaitFullyConnected;
:local Config [ /system/script/get global-config-overlay source ];
/file/add name=($FilePath . ".conf") contents=$Config;
$WaitForFile ($FilePath . ".conf");
- :set ConfigFile ($FileName . ".conf");
- :set Attach ($Attach, ($FilePath . ".conf"));
+
+ :local Size [ :len $Config ];
+ :if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={
+ :set ConfigFile ($FileName . ".conf");
+ :set Attach ($Attach, ($FilePath . ".conf"));
+ } else={
+ $LogPrintExit2 warning $0 ("Creating config file failed. Size should be " . $Size . " bytes, but is not.") false;
+ :set ConfigFile "failed";
+ :set Failed 1;
+ }
}
# send email with status and files