Community discussions

MikroTik App
 
User avatar
DaxStox
newbie
Topic Author
Posts: 41
Joined: Thu Aug 30, 2012 6:59 pm

dns-update stop exection script

Tue Nov 27, 2012 1:27 pm

Hi everyone,

Scenario: RB493 v. 5.19

I use the dns-update command tool to register to a DNS server in a script:
/tool dns-update dns-server=$dnsIP ttl=86400 name=$ssname zone=$zoneDomain address=newIP 
....somenthing to do after dns-update
If the command tool dns-update fail (ex. connection timeout) the script stop his execution and the code after the command is not executed.

How can I avoid this behavior?

Thanks in advance.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: dns-update stop exection script

Thu Nov 29, 2012 8:45 am

I am unaware if there is an official way to avoid this. However, there might a workaround...

Take the dns-update code and put it into a new script. Then, call it from the first script using the undocumented :execute command (http://forum.mikrotik.com/viewtopic.php ... 04#p309004). Something like this:

Main script:
...
:execute script=dnsUpdate
... run checks to see if script succeeded
...
dnsUpdate script:
/tool dns-update dns-server=$dnsIP ttl=86400 name=$ssname zone=$zoneDomain address=newIP
You could also just run the dns-update command in its own script and use a second script would check to see if the script succeeded and respond accordingly. People have done this with a similar Fetch problem: http://forum.mikrotik.com/viewtopic.php ... 12#p319707

Either way, since you use variables in the dns-update command, I think they will need to be global to pass them between the scripts.

Who is online

Users browsing this forum: Maxfadeev699 and 18 guests