From 3ad7b5f2bb4faa49b2febc1673feb29bcc733756 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 19 Jan 2026 14:59:06 +0100 Subject: [PATCH] backup-email: early exit with :exit --- backup-email.rsc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/backup-email.rsc b/backup-email.rsc index fcafff45..b6c26680 100644 --- a/backup-email.rsc +++ b/backup-email.rsc @@ -9,7 +9,6 @@ # create and email backup and config file # https://rsc.eworm.de/doc/backup-email.md -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -41,28 +40,24 @@ :if ([ :typeof $SendEMail2 ] = "nothing") do={ $LogPrint error $ScriptName ("The module for sending notifications via e-mail is not installed."); - :set ExitOK true; - :error false; + :exit; } :if ($BackupSendBinary != true && \ $BackupSendExport != true) do={ $LogPrint error $ScriptName ("Configured to send neither backup nor config export."); - :set ExitOK true; - :error false; + :exit; } :if ([ $ScriptLock $ScriptName ] = false) do={ :set PackagesUpdateBackupFailure true; - :set ExitOK true; - :error false; + :exit; } :if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={ $LogPrint warning $ScriptName ("Running from backup partition, refusing to act."); :set PackagesUpdateBackupFailure true; - :set ExitOK true; - :error false; + :exit; } $WaitFullyConnected; @@ -82,8 +77,7 @@ :if ([ $MkDir $DirName ] = false) do={ $LogPrint error $ScriptName ("Failed creating directory!"); - :set ExitOK true; - :error false; + :exit; } # binary backup @@ -139,5 +133,5 @@ } # do not remove the files here, as the mail is still queued! } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitError; $ExitError false [ :jobname ] $Err; }