kieranbarnes do you know where your towel is?

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
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

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. Apache2 mod_deflate
    The mod_deflate module provides the DEFLATE output filter that allows output from your server to...
  5. Enabling mod_deflate/gzip globally on cPanel
    There's far too many reasons to mention why you should enable mod_deflate to gzip your...

What this article useful to you?



Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Linux, PHP category.

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


No trackbacks yet.