ttft 发表于 2007-5-21 14:13:43

关于ipupdate

我下载了本站老大开发的ipupdate插件,在BFW启动后能更新IP地址(3322的),但在BFW连续运行2天左右,就不能自动更新了,而且用手动更新也不行,提示:
Checking need for update...
Current IP...: 222.213.**.**
Old IP.......: 222.213.**.**
Updating DynDNS -**.8866.org
nc: members.3322.org: Unknown host Response from www.3322.org

如果此时重新启动一下BFW,就可以更新了,这是什么原因呢?

DreamCat 发表于 2007-5-21 14:38:21

我已经在精华区回帖了~~:L
具体原因我也不清楚,没法实验,在我以前的测试、使用过程中,更新是自动的,没有问题。现在的情况不知道是希网修改了什么还是其他什么原因。
下面是具体的代码。你先看看。


#!/bin/sh
#
# DDNS client for www.3322.org
# Code by DreamCat
#       modify form dyndns
#       thanks Claudio Roberto Cussuol
#       23/01/2005
#
. /etc/coyote/coyote.conf
[ "$N3322_UPDATE" != "YES" ] && exit
if [ "$INETTYPE" = "PPPOE" -o "$INETTYPE" = "PPP" ]; then
IF_INET=ppp0
elif [ -z "$IF_INET" ] ; then
IF_INET=eth1
fi
[ "$1" != "log" ] && echo Checking need for update...
[ "$1" != "log" ] && logger www.3322.org : Checking need for update...
CURRENT=`getifaddr $IF_INET`
if [ $? != 0 ]; then
echo Unable to get current IP
logger Unable to get current IP
exit 1
fi
[ "$1" != "log" ] && echo Current IP...: $CURRENT
[ "$1" != "log" ] && logger www.3322.org : Current IP...: $CURRENT
if [ -e /var/log/www.3322.org.ip ] ; then
OLD=`cat /var/log/www.3322.org.ip`
else
OLD=`nslookup $N3322_DOMAIN | tail -n 1 | sed s/Address:\ \ \ \ //`
fi
[ "$1" != "log" ] && echo Old IP.......: $OLD
[ "$1" != "log" ] && logger www.3322.org : Old IP.......: $OLD
if [ "$1" = "force" ] ; then
echo Forcing update
logger www.3322.org : Forcing update
OLD=""
fi
if [ "$CURRENT" != "$OLD" ] ; then
USUARIO=`echo -n "$N3322_USERNAME:$N3322_PASSWORD" | /ipupdate/b64 -e`
[ "$1" != "log" ] && echo Updating DynDNS - $N3322_DOMAIN
echo -e "GET /dyndns/update?system=$N3322_SYSTEM&hostname=$N3322_DOMAIN&offline=$N3322_BREAK HTTP/1.1\r\nUser-Agent: Mozilla/4.0\r\nHost: members.3322.org\r\nAuthorization: Basic $USUARIO\r\n\r\n" | ncmembers.3322.org 80 > /var/log/N3322.txt
RESPONSE=`tail -n 1 /var/log/N3322.txt | head -n 1`
RESPCODE=`echo "$RESPONSE" | cut -f 1 -d " "`
if [ "$RESPCODE" = "good" -o "$RESPCODE" = "nochg" ] ; then
    echo $CURRENT > /var/log/www.3322.org.ip
fi
[ "$1" != "log" ] && echo Response from www.3322.org
[ "$1" != "log" ] && echo ========================
[ "$1" != "log" ] && echo $RESPONSE
[ "$1" != "log" ] && echo ========================
[ "$1" != "log" ] && echo
echo "======================================" >> /var/log/ipupdate.log
date >> /var/log/ipupdate.log
echo $CURRENT >> /var/log/ipupdate.log
echo Updating DynDNS - $N3322_DOMAIN >> /var/log/ipupdate.log
echo $RESPONSE >> /var/log/ipupdate.log
logger DYNDNS:Updating DynDNS - $N3322_DOMAIN - $CURRENT
logger DYNDNS:$RESPONSE
else
[ "$1" != "log" ] && echo The update of $N3322_DOMAIN is not needed
[ "$1" != "log" ] && logger DYNDNS:The update of $N3322_DOMAIN is not needed
echo $CURRENT > /var/log/www.3322.org.ip
fi
页: [1]
查看完整版本: 关于ipupdate