在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 ;
}
本文轉自 h2appy 51CTO部落格,原文連結:http://blog.51cto.com/h2appy/776837,如需轉載請自行聯系原作者