自动更新GeoIP数据库


#!/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天执行一次。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM