Created
November 4, 2010 12:15
-
-
Save laurynas/662373 to your computer and use it in GitHub Desktop.
Fetch GeoLite Cities database from MaxMind
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/sh | |
# | |
# Update GeoLite Cities database from MaxMind | |
# (C) 2010 Laurynas Butkus laurynas.butkus at gmail.com | |
# | |
TMP=/tmp | |
TARGET_DIR=/usr/local/share/GeoIP | |
cd $TMP | |
# download database | |
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz | |
if [ ! -f GeoLiteCity.dat.gz ]; then | |
echo "$TMP/GeoLiteCity.dat.gz not found" | |
exit 1 | |
fi | |
gzip -d GeoLiteCity.dat.gz | |
if [ ! -f GeoLiteCity.dat ]; then | |
echo "$TMP/GeoLiteCity.dat not found" | |
exit 1 | |
fi | |
mv GeoLiteCity.dat $TARGET_DIR/GeoLiteCity.dat.new | |
rm $TARGET_DIR/GeoLiteCity.dat | |
mv $TARGET_DIR/GeoLiteCity.dat.new $TARGET_DIR/GeoLiteCity.dat | |
echo "GeoLite cities database updated." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment