Witam!
Mój problem polega na tym że mam skrypt do aktualizacji adres publicznego IP do DDNS sęk w tym że mam do skryptu przypisany automat na uruchomienie co 2 minuty. Skrypt ten tworzy plik txt z aktualnym adresem i prawdopodobnie go porównuje przed wysłaniem w świat sęk w tym że gdy mój adres się zmieni skrypt zmienia go w pliku ale obstawiam że jeszcze nie ma jak go wysłać bo brakuje mu sieci ?? w każdym bądź razie ie zmienia mi się adres w DDNS. Jak zrobię to ręcznie na zasadzie suń plik txt z mikrotika z adresem i uruchom skrypt bądź uruchomi się z automatu to podaje adres już do DDNS, po wykonanym skrypcie już plik tworzy się na nowo.
Podaje skrypt może ktoś coś pomoże choćby zniwelować ten plik niech wysyła za każdym razem czy coś innego.
############## Script FreeDNS.afraid.org ##################
############## PARSER EDITION ##################
############## CREATED LESHIY_ODESSA ##################
# Specify the "Direct URL", which is https://freedns.afraid.org/dynamic/
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http". Also see below.
# In front of the sign "?" put a backslash "\".
:global "direct-url" ""
# Specify the URL API "ASCII"
# Log in under your account and open the page https://freedns.afraid.org/api/
# Then copy the URL of your site - Available API Interfaces : ASCII (!!! NOT XML !!!)
# ATTENTION!!!! Before the question mark, put a backslash "\".
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http".
:global "api-url" ""
# Specify your domain or subdomain.
:global "dns-domain" ""
# Define variables for the external (WAN) interface
# Case sensitive.
:global "out-interface" "pppoe-out1"
# !!!!!!!!!!!!!!!!! Nothing more do not need to edit!!!!!!!!!!!!!!!!!
# Check whether the file with the IP domain - freedns.txt
:if ([:len [/file find name=freedns.txt]] > 0) do={
} else={
/tool fetch url=$"api-url" dst-path="/freedns.txt"
}
# Find out the IP address of the domain using the API and parsing.
# Split the file
:local "result" [/file get freedns.txt contents]
:local "startloc" ([:find $"result" $"dns-domain"] + ([:len $"dns-domain"] + 1))
:local "endloc" ([:find $"result" $"direct-url" -1] -1)
:global "dns-domain-ip" [:pick $"result" $"startloc" $"endloc"]
# Find the current IP address on the external interface
:global "current-ip" [/ip address get [find interface=$"out-interface"] address]
# Obtained from IP addresses to be excluded subnet mask
:set "current-ip" [:pick $"current-ip" 0 ([:len $"current-ip"]-3) ]
# Compare the external IP with the IP address of the DNS domain.
:if ($"current-ip" != $"dns-domain-ip") do={
# If different, then sent to freedns.afraid.org our external IP by using Direct URL
:log info ("Service Dynamic DNS: old IP address $"dns-domain-ip" for $"dns-domain" CHANGED to -> $"current-ip"")
/tool fetch url=$"direct-url" keep-result=no
# Download the file with the new IP after 5 sec.
:delay 5
/tool fetch url=$"api-url" dst-path="/freedns.txt"
} else={
# Not to clog the log, you need to comment out this line.
:log info ("IP address is NOT CHANGED, the update is not required")
}
# Since version RouterOS version 6.0rc12 supported encryption /tool fetch mode=https
# In :global "direct-url" need to change to httpS://
# For RouterOS version 6.xx
# /tool fetch mode=https url=$"direct url"
# :global "direct-url" "https://freedns.afraid.org/dynamic/update.php\?UVdjU2lzQmQwSkdjZW9aWkNleTdJdXFtOjg2NTI0NzE="
# http://wiki.mikrotik.com/wiki/Manual:Scripting
# http://wiki.mikrotik.com/wiki/Manual:Scripting-examples
# http://wiki.mikrotik.com/wiki/Manual:Tools/Fetch
# http://forum.ixbt.com/topic.cgi?id=14:60498-86#2373
##############Script FreeDNS.afraid.org##################