Created
March 2, 2012 09:56
-
-
Save vstoykov/1957452 to your computer and use it in GitHub Desktop.
Download MaxMind free database and place it in default location for pygeoip
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 | |
if [ `whoami` != 'root' ]; then | |
echo "You must to be root" | |
exit | |
fi | |
DOWNLOAD_URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" | |
TEMPFILE="/tmp/GeoIPCity.dat" | |
TEMPFILEGZ="$TEMPFILE.gz" | |
GEOIP_DIR="/usr/local/share/GeoIP" | |
GEOIPFILE="$GEOIP_DIR/GeoIPCity.dat" | |
[ ! -d "/usr/local/share/GeoIP" ] && mkdir -p $GEOIP_DIR | |
wget -N $DOWNLOAD_URL --output-document=$TEMPFILEGZ | |
echo "Extracting to right location..." | |
gunzip $TEMPFILEGZ | |
cp --remove-destination $TEMPFILE $GEOIPFILE | |
rm $TEMPFILE | |
echo "Done" | |
echo " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment