X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=scripts%2Fupdategeoip.sh;h=2ac398d2a1646a5fee2ab1fc2a99a33c1623a726;hp=eb9327e23a22d1d9a8b72abf11f37c2af4baa233;hb=c06c7fd6e6f26d31abb8d7c9a9f9e3f2d5b27d5c;hpb=190fd621df4920c56a422c03663874cddaa67d64 diff --git a/scripts/updategeoip.sh b/scripts/updategeoip.sh index eb9327e..2ac398d 100755 --- a/scripts/updategeoip.sh +++ b/scripts/updategeoip.sh @@ -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;"