backup-cloud: early exit with :exit

This commit is contained in:
Christian Hesse 2026-01-19 14:57:52 +01:00
parent 33fb1ae7eb
commit d4547ecbfa

View file

@ -9,7 +9,6 @@
# upload backup to MikroTik cloud # upload backup to MikroTik cloud
# https://rsc.eworm.de/doc/backup-cloud.md # https://rsc.eworm.de/doc/backup-cloud.md
:local ExitOK false;
:onerror Err { :onerror Err {
:global GlobalConfigReady; :global GlobalFunctionsReady; :global GlobalConfigReady; :global GlobalFunctionsReady;
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
@ -36,15 +35,13 @@
:if ([ $ScriptLock $ScriptName ] = false) do={ :if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true; :set PackagesUpdateBackupFailure true;
:set ExitOK true; :exit;
:error false;
} }
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={ :if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act."); $LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true; :set PackagesUpdateBackupFailure true;
:set ExitOK true; :exit;
:error false;
} }
$WaitFullyConnected; $WaitFullyConnected;
@ -55,8 +52,7 @@
:if ([ $MkDir ("tmpfs/backup-cloud") ] = false) do={ :if ([ $MkDir ("tmpfs/backup-cloud") ] = false) do={
$LogPrint error $ScriptName ("Failed creating directory!"); $LogPrint error $ScriptName ("Failed creating directory!");
:set ExitOK true; :exit;
:error false;
} }
:local I 5; :local I 5;
@ -100,5 +96,5 @@
} }
$RmDir "tmpfs/backup-cloud"; $RmDir "tmpfs/backup-cloud";
} do={ } do={
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err; :global ExitError; $ExitError false [ :jobname ] $Err;
} }