在ROS 5.12 上使用3322.org的动态域名,下面是自动更新脚本,把它用在schedule中就能实现自动更新动态域名了。在网上找的代码,可是有些小问题,我已经修正了,并在ROS 5.12下测试通过。
- :global ednsuser "username"
- :global ednspass "password"
- :global ednshost "myddnsname.3322.org"
- :global ednsinterface "pppoe-out1"
- :global members "http://members.3322.org/dyndns/update\?system=dyndns"
- :global status
- :global status [/interface get [/interface find name=$ednsinterface] running]
- :if ($status!=false) do={
- :global ednslastip [:resolve $ednshost]
- :if ([ :typeof $ednslastip ] = nil ) do={ :global ednslastip "0" }
- :global ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ]
- :global ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]]
- :global ednsstr "&hostname=$ednshost&myip=$ednsip"
- :if ($ednslastip != $ednsip) do={
- /tool fetch url="$members$ednsstr" mode=http user=$ednsuser password=$ednspass dst-path=$ednshost
- :delay 4
- :global result [/file get $ednshost contents]
- :log info ($ednshost . " " .$result)
- /file remove $ednshost ;
- }
- }