mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-20 16:09:32 +00:00
update-tunnelbroker: early exit with :exit
This commit is contained in:
parent
1ce8a54440
commit
eb182fe769
1 changed files with 4 additions and 8 deletions
|
|
@ -11,7 +11,6 @@
|
||||||
# update local address of tunnelbroker interface
|
# update local address of tunnelbroker interface
|
||||||
# https://rsc.eworm.de/doc/update-tunnelbroker.md
|
# https://rsc.eworm.de/doc/update-tunnelbroker.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) \
|
||||||
|
|
@ -24,14 +23,12 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ $CertificateAvailable "Starfield Root Certificate Authority - G2" "fetch" ] = false) do={
|
:if ([ $CertificateAvailable "Starfield Root Certificate Authority - G2" "fetch" ] = false) do={
|
||||||
$LogPrint error $ScriptName ("Downloading required certificate failed.");
|
$LogPrint error $ScriptName ("Downloading required certificate failed.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Interface in=[ /interface/6to4/find where comment~"^tunnelbroker" !disabled ] do={
|
:foreach Interface in=[ /interface/6to4/find where comment~"^tunnelbroker" !disabled ] do={
|
||||||
|
|
@ -54,8 +51,7 @@
|
||||||
|
|
||||||
:if (!($Data ~ "^(good|nochg) ")) do={
|
:if (!($Data ~ "^(good|nochg) ")) do={
|
||||||
$LogPrint error $ScriptName ("Failed sending the local address to tunnelbroker or unexpected response!");
|
$LogPrint error $ScriptName ("Failed sending the local address to tunnelbroker or unexpected response!");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local PublicAddress [ :pick $Data ([ :find $Data " " ] + 1) [ :find $Data "\n" ] ];
|
:local PublicAddress [ :pick $Data ([ :find $Data " " ] + 1) [ :find $Data "\n" ] ];
|
||||||
|
|
@ -70,5 +66,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} 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