I use Winbox often instead of the CLI, where it shows this:
The “Don’t Require Permissions” checkbox is checked. Doesn’t that mean “dont-require-permissions=yes”
And yet, the export does indeed show “dont-require-permissions=no”
when I realized I have 2 different scripts (see if you can tell the difference):
dyndns
DynDNS
Ugh – I think the system (but more likely I) was confusing them somewhere along the way.
Using a form of brute force troubleshooting, I’m pretty sure I’ve isolated the problem as occuring only when there is a change in IP number, and probably stemming from this line (4th from end of script) in the script:
/file remove "$identitydate-IP.txt"
This is the script that is causing the error:
/system
:local cdate [clock get date]
:local yyyy [:pick $cdate 0 4]
:local MM [:pick $cdate 5 7]
:local dd [:pick $cdate 8 10]
:local identitydate "$[identity get name]_$yyyy-$MM-$dd"
#/export show-sensitive file="$identitydate"
# Export public IP and mail it
#/ip/address print file="$identitydate-IP"
#/tool fetch upload=yes mode=ftp ascii=no src-path="$[$identitydate]-IP.txt" dst-path="/mikrotik-backups/$[$identitydate]-IP.txt" address=192.168.2.22 port=21 user=mikrotik password=mikrotik
#/file remove "$identitydate-IP.txt"
# Set needed variables
:local username "<dyndns-username"
:local clientkey "9axxxxx"
:local hostname "<host>.dyndns.org"
:global dyndnsForce
:global previousIP
# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html"
:delay 1
:local result [/file get dyndns.checkip.html contents]
# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "UpdateDynDNS: currentIP = $currentIP"
# Remove the # on next line to force an update every single time - useful for debugging,
# but you could end up getting blacklisted by DynDNS!
#:set dyndnsForce true
# Determine if dyndns update is needed
# more dyndns updater request details https://help.dyn.com/remote-access-api/perform-update/
:log info "UpdateDynDNS: previousIP = $previousIP"
:if ($dyndnsForce = true) do={ :log warning "UpdateDynDNS: Forced update on" }
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:set previousIP $currentIP
/tool fetch mode=https \
url="https://$username:$clientkey@members.dyndns.org/v3/update?hostname=$hostname&myip=$currentIP" \
dst-path="/dyndns.txt"
:delay 5
:local result [/file get dyndns.txt contents]
:log info ("UpdateDynDNS: Dyndns update needed")
:log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
/ip/address print file="$identitydate-IP"
/tool fetch upload=yes mode=ftp ascii=no src-path="$[$identitydate]-IP.txt" dst-path="/mikrotik-backups/$[$identitydate]-IP.txt" address=192.168.2.22 port=21 user=mikrotik password=mikrotik
/file remove "$identitydate-IP"
} else={:log info ("UpdateDynDNS: No dyndns update needed")}
:set dyndnsForce
:set previousIP
for localize all commands without write in every line /system,
on this case only date is used, but also gmt-offset, time-zone-autodetect, dst-active, time, time-zone-name can be obtained without write everytime /system
I know that … wrong question asked: What is the purpose of that?
Just for a few commands? All others are fully qualified so maybe the wrong default context set with /system is the problem?