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]
# 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;"