Forked from mrs83/Maxmind's GeoLite GeoIP database update script
Created
January 3, 2017 02:37
-
-
Save sgeto/7c1c10b85cc7c48e51d993924c44b064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# geoip-update.sh -- update geoip lite database(s). | |
# author: massimo.scamarcia@gmail.com | |
#prg="wget --quiet" | |
prg="wget" | |
download_path="/usr/share/GeoIP/download" | |
geolite_path="/usr/share/GeoIP" | |
#set -e | |
[ -d $download_path ] || mkdir $download_path | |
if [ ! -e $geolite_path ]; then | |
echo "Unable to find GeoIP directory: $geolite_path" | |
exit 1 | |
fi | |
cd $download_path | |
$prg http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | |
if [ ! -e $download_path/GeoIP.dat.gz ]; then | |
echo "Unable to find GeoIP.dat.gz!" | |
exit 1 | |
fi | |
gunzip -c $download_path/GeoIP.dat.gz > $geolite_path/GeoIP.dat | |
rm -f $download_path/GeoIP.dat.gz | |
$prg http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz | |
if [ ! -e $download_path/GeoLiteCity.dat.gz ]; then | |
echo "Unable to find GeoLiteCity.dat.gz!" | |
exit 1 | |
fi | |
gunzip -c $download_path/GeoLiteCity.dat.gz > $geolite_path/GeoLiteCity.dat | |
rm -f $download_path/GeoLiteCity.dat.gz | |
$prg http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz | |
if [ ! -e $download_path/GeoIPv6.dat.gz ]; then | |
echo "Unable to find GeoIPv6.dat.gz!" | |
exit 1 | |
fi | |
gunzip -c $download_path/GeoIPv6.dat.gz > $geolite_path/GeoIPv6.dat | |
rm -f $download_path/GeoIPv6.dat.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment