http://wiki.contribs.org/GeoIPafter following directions in the GeoIP contrib wiki
The new GeoIp.dat file created by way of the crontab into the directory /var/lib/GeoIp does not update(copy) the GeoIP.dat file into /usr/share/GeoIP.
I understand the geoiplookup program defaults to looking for the file GeoIP.dat in the directory of /usr/share/GeoIP.
I tested the geoiplookup after deleting the file in the directory of /usr/share/GeoIP (rm -f /usr/share/GeoIp/GeoIP.dat) and the geoiplookup program does not return anything if the file is not there at that location. geoiplookup does have an override option to specify the database ( geoiplookup -f /var/lib/GeoIP/GeoIP.dat google.com).
to show your both the current GeoIP.dat files here is the commands
ls -l /var/lib/GeoIP
ls -l /usr/share/GeoIP
This bash file does download the new GeoIP.dat file and updates the /usr/share/GeoIP directory as well.
geoipdatupdate
#!/bin/bash
cd /
mkdir -p /var/lib/GeoIP
mkdir -p /usr/share/GeoIP
cd /var/lib/GeoIP
rm -f /var/lib/GeoIP/GeoIP.dat.gz
rm -f /var/lib/GeoIP/GeoIP.dat.gz.*
wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz > /dev/null
if [ -f "GeoIP.dat.gz" ];then
rm -f /var/lib/GeoIP/GeoIP.dat
gunzip GeoIP.dat.gz > /dev/null
fi
if [ -f "GeoIP.dat" ];then
rm -f /usr/share/GeoIP/GeoIP.dat
cp GeoIP.dat /usr/share/GeoIP
fi
#ls -l /var/lib/GeoIP
#ls -l /usr/share/GeoIP
exit 0
The crontab shows a once a month chance to update the GeoIP.dat file.
I think that this can be improved on by having more than one chance.
I will look into creating a hourly or daily cron that updates the GeoIP.dat file.
The GeoIP.dat file is changed monthly on the GeoIP.dat supplier side and that occurs more towards the beginning of the month, from what I understand.