These are two fairly simple hacks I whipped up late one night in an effort to resolve a feature request
logged against the GeoIP packages I maintain for Fedora Extras, as the stock geoupupdate(1) doesn't deal
with the free databases Maxmind provide.
Their function is fairly simple - go out and fetch an updated copy of the appropriate GeoIP .dat file,
move the old one out and uncompress the newly-fetched file in place.
Requirements are fairly minimal:
- Perl (no, really!)
- gzip (part of most base installs anyway)
- Perl's LWP::Simple module (often packaged as "perl-libwww")
Usage:
It's best run from cron, usually on the first or second of the month when Maxmind update the files.
The scripts take no arguments; if you want to know how they work, read the source!
Download (Right click and "Save As" advised, remove the .txt when downloaded):
fetch-geoipdata.pl - This fetches the free GeoIP "lite" database (~2mb)
fetch-geoipdata-city.pl - This is for fetching the GeoIPCity
Lite database (~25mb)
TODO:
- Merge the scripts into one generic fetcher
- Logging (syslog?) and better error handling
- More testing - it works for me, but I'm the only one testing it so far :-)
- Configuration options / getopt argument handling