This is an old revision of the document!
http://wiki.mikrotik.com/wiki/Scripts
http://forum.mikrotik.com/viewtopic.php?p=171805
Copy and paste this script at the CLI to generate a script to be scheduled:
/system script add name=dyndns policy=\ ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\ \n# Dynamic DNS Update Script\r\ \n#\r\ \n# Name resolution must be working.\r\ \n#\r\ \n# Set needed variables\r\ \n:local username \"dyndnsuser\"\r\ \n:local password \"dyndnspass\"\r\ \n:local hostname \"dyn,dns.hostname\"\r\ \n\r\ \n:local dyndnsForce \"\"\r\ \n:local previousIP [:resolve \$hostname]\r\ \n\r\ \n# print some debug info\r\ \n#:log info (\"UpdateDynDNS: username = \$username\")\r\ \n#:log info (\"UpdateDynDNS: password = \$password\")\r\ \n:log info (\"UpdateDynDNS: hostname = \$hostname\")\r\ \n:log info (\"UpdateDynDNS: previousIP = \$previousIP\")\r\ \n\r\ \n# get the current IP address from the Internet (in case of double-nat)\r\ \n/tool fetch mode=http address=\"checkip.dyndns.org\" src-path=\"/\" dst-path=\"/dyndns.checkip.html\"\r\ \n:delay 1\r\ \n:local result [/file get dyndns.checkip.html contents]\r\ \n\r\ \n# parse the current IP result\r\ \n:local resultLen [:len \$result]\r\ \n:local startLoc [:find \$result \": \" -1]\r\ \n:set startLoc (\$startLoc + 2)\r\ \n:local endLoc [:find \$result \"</body>\" -1]\r\ \n:local currentIP [:pick \$result \$startLoc \$endLoc]\r\ \n:log info \"UpdateDynDNS: currentIP = \$currentIP\"\r\ \n\r\ \n# Remove the # on next line to force an update every single time - useful for debugging,\r\ \n# but you could end up getting blacklisted by DynDNS!\r\ \n\r\ \n#:set dyndnsForce true\r\ \n\r\ \n# Determine if dyndns update is needed\r\ \n# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html\r\ \n\r\ \n:if ((\$currentIP != \$previousIP) || (\$dyndnsForce = true)) do={\r\ \n:set dyndnsForce false\r\ \n:set previousIP \$currentIP\r\ \n\r\ \n/tool fetch user=\$username password=\$password mode=http address=\"members.dyndns.org\" \\\r\ \nsrc-path=\"nic/update\?system=dyndns&hostname=\$hostname&myip=\$currentIP&wildcard=no\" \\\r\ \ndst-path=\"/dyndns.txt\"\r\ \n:delay 1\r\ \n:local result [/file get dyndns.txt contents]\r\ \n:log info (\"UpdateDynDNS: Dyndns update needed\")\r\ \n:log info (\"UpdateDynDNS: Dyndns Update Result: \".\$result)\r\ \n:put (\"Dyndns Update Result: \".\$result)\r\ \n#/tool e-mail send from=email@gmail.com server=173.194.77.108 to=me@gmail.com subject=\"Current IP is \$currentIP\"\r\ \n#:log info \"Email of new IP address sent\"\r\ \n} else={\r\ \n:log info (\"UpdateDynDNS: No dyndns update needed\")\r\ \n}"
/system script run dyndns
/system scheduler add comment="Update DynDNS" disabled=no interval=10m name=dyndns \ on-event=dyndns policy=reboot,read,write,policy,test,password,sniff,sensitive \ start-date=jan/01/1970 start-time=12:34:56;