您的位置:首页 > 数据库

自动更新GeoIP数据库

2017-05-12 19:59 691 查看
#!/bin/bash
if [ ! -d /usr/local/share/GeoIP ];then
mkdir /usr/local/share/GeoIP
fi

if [ ! -d /usr/local/share/qqIP ];then
mkdir /usr/local/share/qqIP
fi

wget -t 5 -O /tmp/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz wget -t 5 -O /tmp/GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz wget -t 5 -O /tmp/GeoIPASNum.dat.gz http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz 
gzip -df /tmp/GeoIP.dat.gz
gzip -df /tmp/GeoLiteCity.dat.gz
gzip -df /tmp/GeoIPASNum.dat.gz

mv -f /tmp/Geo*.dat /usr/local/share/GeoIP/


脚本名可任意取,比如update_geoip.sh,然后添加定时任务,每隔5天执行一次。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: