backup-email: use :retry and $FileExists ...

... to work around restrictions in new file handling.
This commit is contained in:
Christian Hesse 2025-05-30 22:39:18 +02:00
parent 8353a8547f
commit a2f837be59

View file

@ -27,6 +27,7 @@
:global CleanName; :global CleanName;
:global DeviceInfo; :global DeviceInfo;
:global FileExists;
:global FormatLine; :global FormatLine;
:global LogPrint; :global LogPrint;
:global MkDir; :global MkDir;
@ -124,16 +125,16 @@
attach=$Attach; remove-attach=true }); attach=$Attach; remove-attach=true });
# wait for the mail to be sent # wait for the mail to be sent
:local I 0; :do {
:while ([ :len [ /file/find where name ~ ($FilePath . "\\.(backup|rsc)\$") ] ] > 0) do={ :retry {
:if ($I >= 120) do={ :if ([ $FileExists ($FilePath . ".backup") "backup" ] = true || \
$LogPrint warning $ScriptName ("Files are still available, sending e-mail failed."); [ $FileExists ($FilePath . ".rsc") "script" ] = true) do={
:set PackagesUpdateBackupFailure true; :error "Files are still available.";
:set ExitOK true; }
:error false; } delay=1s max=120;
} } on-error={
:delay 1s; $LogPrint warning $ScriptName ("Files are still available, sending e-mail failed.");
:set I ($I + 1); :set PackagesUpdateBackupFailure true;
} }
} do={ } do={
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err; :global ExitError; $ExitError $ExitOK [ :jobname ] $Err;