From 341e84682cd3242735a0776640901ed0b9b7bebe Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 6 Mar 2024 15:28:55 +0100 Subject: ipsec-to-dns: drop main function, use :do with on-error --- ipsec-to-dns.rsc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ipsec-to-dns.rsc b/ipsec-to-dns.rsc index e19a11b..03abf59 100644 --- a/ipsec-to-dns.rsc +++ b/ipsec-to-dns.rsc @@ -11,8 +11,8 @@ :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } -:local Main do={ - :local ScriptName [ :tostr $1 ]; +:do { + :local ScriptName [ :jobname ]; :global Domain; :global HostNameInZone; @@ -26,7 +26,7 @@ :global ScriptLock; :if ([ $ScriptLock $ScriptName ] = false) do={ - :return false; + :error false; } :local Zone \ @@ -76,6 +76,4 @@ /ip/dns/static/add name=$Fqdn address=($PeerVal->"dynamic-address") ttl=$Ttl comment=$Comment place-before=$PlaceBefore; } } -} - -$Main [ :jobname ]; +} on-error={ } -- cgit v1.2.3-54-g00ecf