cgs2006 发表于 2009-5-3 20:03:12

ddns不能动态更新IP,有时候手动运行脚本可以,有时候又不可以更新,郁闷!

环境:ROS2.9.27
用计划任务执行 运行次数是有的 但手动更新运行有时候可以有时候又不可以更新

代码: 用ros脚本生成器2.0 生成

第一个代码::log info "DDNS: Begin"
:global ddns-user "用户名"
:global ddns-pass "密码"
:global ddns-host "用户名.dns-dns.com"
:global ddns-interface "pppoe-out1"
:global ddns-system ("mt-" . version] )
:global ddns-ip [ /ip address get address ]
:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }
:if ([ :typeof $ddns-ip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.") } else={
:if ($ddns-ip != $ddns-lastip) do={
:log info "DDNS: Sending UPDATE!"
:log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
:global ddns-lastip $ddns-ip } else={
:log info "DDNS: No change"
}
}
:log info "DDNS: End"

第二个代码::log info "DDNS: Begin"
:global ddns-user "用户名"
:global ddns-pass "密码"
:global ddns-host "*1"
:global ddns-interface "pppoe-out1"
:global ddns-ip [ /ip address get address ]
:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }
:if ([ :typeof $ddns-ip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.")
} else={
:if ($ddns-ip != $ddns-lastip) do={
    :log info "DDNS: Sending UPDATE!"
    :log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
    :global ddns-lastip $ddns-ip
} else={
    :log info "DDNS: No change"
}
}
:log info "DDNS: End"

tancunf4 发表于 2009-5-29 10:17:36

我都系这个总是`

小小鸟 发表于 2009-5-29 18:24:50

:global ddnsip address ];
:global ddnsnip [:pick $ddnsip 0 [:find $ddnsip "/" ] ] ;
:if ($ddnsnip !=[:resolve "xxxx.25u.com"] ) do={:log info ;};
页: [1]
查看完整版本: ddns不能动态更新IP,有时候手动运行脚本可以,有时候又不可以更新,郁闷!