User:Fstirlitz/geolite2 update script
#!/bin/bash DBNAME=GeoLite2-City PATHNAME="/var/lib/geoip/$DBNAME.mmdb" curl -qs "https://geolite.maxmind.com/download/geoip/database/$DBNAME.mmdb.gz" -z "$PATHNAME" -o "$PATHNAME.gz" if [[ -r "$PATHNAME.gz" ]]; then gunzip -f "$PATHNAME.gz" if ! ( curl -qs "https://geolite.maxmind.com/download/geoip/database/$DBNAME.md5"; echo " $PATHNAME" ) | md5sum --quiet -c -; then rm -f "$PATHNAME" fi fi
instructions:
- make sure you have curl, gzip and bash installed (you do most likely, but just in case)
mkdir -p /var/lib/geoip
- install the above script in your
/etc/cron.weekly
(and give it execute permissions) - run it
this will ensure that you have a fresh version of maxmind's geolite2 database in your /var/lib/geoip
directory. mmdblookupAUR can use it so: mmdblookup -f /var/lib/geoip/GeoLite2-City.mmdb […]
; you may use my ../quick and dirty geoip lookup script. if you wish to use the "country" db instead, switch the second line to DBNAME=GeoLite2-Country
.