在ROS 5.12 上使用3322.org的动态域名,下面是自动更新脚本,把它用在schedule中就能实现自动更新动态域名了。在网上找的代码,可是有些小问题,我已经修正了,并在ROS 5.12下测试通过。

 

 
  
  1. :global ednsuser "username" 
  2. :global ednspass "password" 
  3. :global ednshost "myddnsname.3322.org" 
  4. :global ednsinterface "pppoe-out1" 
  5. :global members "http://members.3322.org/dyndns/update\?system=dyndns" 
  6. :global status 
  7. :global status [/interface get [/interface find  name=$ednsinterface] running] 
  8.  
  9. :if ($status!=false) do={ 
  10. :global ednslastip [:resolve $ednshost] 
  11. :if ([ :typeof $ednslastip ] = nil ) do={ :global ednslastip "0" } 
  12. :global ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ] 
  13. :global ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]] 
  14. :global ednsstr "&hostname=$ednshost&myip=$ednsip" 
  15. :if ($ednslastip != $ednsip) do={ 
  16. /tool fetch url="$members$ednsstr" mode=http user=$ednsuser password=$ednspass dst-path=$ednshost 
  17. :delay 4 
  18. :global result [/file get $ednshost contents] 
  19. :log info ($ednshost . " " .$result) 
  20. /file remove $ednshost ;