Skip to content

Instantly share code, notes, and snippets.

@lukenm
lukenm / update_geoip_databases.sh
Last active December 13, 2020 12:03
Shell script to update global Maxmind GeoIP databases. This script can be run via cron.
#!/bin/bash
DAT_DIR=/usr/share/GeoIP
DAT_URLS="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
for FILE in $DAT_DIR/*.dat; do
cp $FILE $FILE.bak
done;
for URL in $DAT_URLS; do