Automatically updating Maxmind geolite2 database

Create a bash script:
#cat updatedb

#!/bin/bash

echo Updating Maxmind databases:
cd /var/www/virtual/joel.co.in/testprojects/htdocs
wget -r http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
mv geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz ./GeoLite2-City.mmdb.gz

Add a cron file:
#cat geolitecron

# top of crontab
[email protected]

0 23 * * * /var/www/virtual/joel.co.in/testprojects/htdocs/updatedb

# end of crontab

Add it to cron:

crontab geolitecron

That’s it..