]> dev.renevier.net Git - syj.git/blobdiff - scripts/updategeoip.sh
add mapquest layer back
[syj.git] / scripts / updategeoip.sh
index eb9327e23a22d1d9a8b72abf11f37c2af4baa233..2ac398d2a1646a5fee2ab1fc2a99a33c1623a726 100755 (executable)
@@ -3,8 +3,7 @@ set -e
 
 GEOIPDB=http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
 
-EXECDIR=$PWD/${0%/*}
-. $EXECDIR/db_auth.sh
+. ${0%/*}/db_auth.sh
 
 usage() {
     echo Usage: ${0##*/} [options]
@@ -81,3 +80,4 @@ unzip ${GEOIPDB##*/} $GEOIPCVS
 
 # insert all values from csv to database
 sed -e 's/"\([^"]\+\)","\([^"]\+\)","\([^"]\+\)","\([^"]\+\)","\([^"]\+\)","\([^"]\+\)"/INSERT INTO geoip (begin_ip, end_ip, country) VALUES ('\''\3'\'','\''\4'\'','\''\5'\'');/' $GEOIPCVS | psql --set "ON_ERROR_STOP=1" -f -
+psql --set "ON_ERROR_STOP=1" -c "VACUUM ANALYZE geoip;"