慕田峪3266474
qq_你的朋友_0
没有好办法,只能是crontab脚本定时reload一次 。reload不影响服务器都,只是加载配置文件。Q 531317590
chanlang
wget使用大写的O
慕仔7147015
# script for getting smart dns IP database
FILE=/opt/apnic/ip_apnic
if [ ! -e $FILE ];then
wget http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest -O $FILE
fi
rm -f cn.net chinanet unicom cmcc others
grep 'apnic|CN|ipv4|' $FILE | cut -f4,5 -d '|' |sed -e 's/|/ /g' | while read ip cnt
do
echo $ip:$cnt
mask=$(cat << EOF | bc | tail -1
pow=32;
define log2(x) {
if (x <= 1) return (pow);
pow--;
return (log2(x/2));
}
log2($cnt)
EOF
)
echo $ip/$mask>> cn.net
if whois $ip | grep "netname" | grep -i ".*chinanet.*\|.*telecom.*" > /dev/null;then
echo $ip/$mask>> chinanet
elif whois $ip | grep "netname" | grep -i ".*unicom.*" >> /dev/null;then
echo $ip/$mask>> unicom
elif whois $ip | grep "netname" | grep -i ".*chinamobile.*" >> /dev/null;then
echo $ip/$mask>> cmcc
else
echo $ip/$mask>> others
fi
done
Jeson
Longingforthesun
不是很懂,这应该不是shell的语法吧
田心枫
怎么说呢,dns服务器这方面你要先了解,我也不是很清楚
慕粉183037419
还好吧。多看看就会了
玫瑰宝宝的天空
可以使用ping检测