mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-20 16:09:32 +00:00
backup-cloud: early exit with :exit
This commit is contained in:
parent
33fb1ae7eb
commit
d4547ecbfa
1 changed files with 4 additions and 8 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue