mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-16 18:19:36 +00:00
backup-upload: early exit with :exit
This commit is contained in:
parent
9056e6d10c
commit
65d6044793
2 changed files with 7 additions and 12 deletions
|
|
@ -4,13 +4,12 @@
|
||||||
# https://rsc.eworm.de/COPYING.md
|
# https://rsc.eworm.de/COPYING.md
|
||||||
#
|
#
|
||||||
# provides: backup-script, order=50
|
# provides: backup-script, order=50
|
||||||
# requires RouterOS, version=7.19
|
# requires RouterOS, version=7.22
|
||||||
# requires device-mode, fetch
|
# requires device-mode, fetch
|
||||||
#
|
#
|
||||||
# create and upload backup and config file
|
# create and upload backup and config file
|
||||||
# https://rsc.eworm.de/doc/backup-upload.md
|
# https://rsc.eworm.de/doc/backup-upload.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) \
|
||||||
|
|
@ -47,21 +46,18 @@
|
||||||
:if ($BackupSendBinary != true && \
|
:if ($BackupSendBinary != true && \
|
||||||
$BackupSendExport != true) do={
|
$BackupSendExport != true) do={
|
||||||
$LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
|
$LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
: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;
|
||||||
|
|
@ -81,8 +77,7 @@
|
||||||
|
|
||||||
:if ([ $MkDir $DirName ] = false) do={
|
:if ([ $MkDir $DirName ] = false) do={
|
||||||
$LogPrint error $ScriptName ("Failed creating directory!");
|
$LogPrint error $ScriptName ("Failed creating directory!");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# binary backup
|
# binary backup
|
||||||
|
|
@ -174,5 +169,5 @@
|
||||||
}
|
}
|
||||||
$RmDir $DirName;
|
$RmDir $DirName;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitOnError; $ExitOnError [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Upload backup to server
|
||||||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||||
[](https://mikrotik.com/download/changelogs/)
|
[](https://mikrotik.com/download/changelogs/)
|
||||||
[](https://t.me/routeros_scripts)
|
[](https://t.me/routeros_scripts)
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue