kieranbarnes Independent PHP, WordPress & CubeCart Programmer

Auto Updating GeoIP Binary Databases

Posted on January 14, 2008

Here's how I keep on top of updating the GeoIP binary databases used by various scripts and applications I use.

I have a script called /usr/local/sbin/geoip-update

#!/bin/sh
cd /usr/local/share-php
wget -q http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
wget -q http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -d -f GeoIP.dat.gz
gzip -d -f GeoLiteCity.dat.gz
rm -rf http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
rm -rf http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

It runs every month from cron, like this

30 22 2 * * /usr/local/sbin/geoip-update

Related posts

  1. City & Country Location Finding with GeoIP
    Following on from a previous post, "PHP Geo-IP Location in 4 lines", I've had a...
  2. mod_geoip Revisted including stopping spam in phpBB 2
    I've recently moved a client's forum onto a new cPanel server, previously it was on...
  3. PHP Geo-IP Location in 4 lines
    Want to look up IP addresses to a geographical location? Firstly, download maxmind_geoip.php and GeoIP...
  4. WordPress Auto Install Script for cPanel
    I have released version one of my WordPress Auto Install Script for cPanel. This script can...
  5. Installing nginx & PHP-FPM securely on CentOS
    I won't go into the reasons why you should install nginx, if you're here, you've...

Posted by Kieran


Filed under: Linux, PHP Leave a comment
Comments (1) Trackbacks (0)
  1. The address for the GeoIP.dat.gz has changed to:
    http://www.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

    and the two “rm ….” lines can be removed as the two previous “gzip -d -f …” cause the gz files to be removed automagically.

    tks,


Leave a comment

(required)

No trackbacks yet.