Raised This Month: $51 Target: $400
 12% 

[SCRIPT] Update GeoIP data for all players in HLX:CE Database


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pricetx
Junior Member
Join Date: Jan 2013
Old 12-22-2015 , 11:41   [SCRIPT] Update GeoIP data for all players in HLX:CE Database
Reply With Quote #1

After a recent server migration, I noticed that I had failed to install Geo::IP::PurePerl, so I had several months of players without any location information.

I decided to write a short Perl script which iterates through all of the players in the HLX:CE database, grabs their IP, finds their location, and updates it in the database. It's pretty fast, as on my database of around 7,000 players, it takes around 5 seconds to complete.

To get it to work, just update the fields at the top of the file with the correct DB username password and host. It needs your GeoLiteCity.dat file to work, so either stick this file in the same location as your GeoLiteCity.dat, or change the path to point to it. Don't forget to run install_binary.sh first before running this script!

The script can be found below:
https://github.com/Pricetx/HLStatsX-GeoIP-Update

If you have any issues, let me know and I'll try to assist. Also, this is the first thing I've done in Perl, so if you notice anything incorrect or potentially dangerous, please let me know.
Pricetx is offline
bopie
New Member
Join Date: Jan 2016
Old 01-29-2016 , 15:34   Re: [SCRIPT] Update GeoIP data for all players in HLX:CE Database
Reply With Quote #2

This script works perfectly except for one little mistype in it

After

$geoip_path = "GeoLiteCity.dat"

there need to be a

;

so if you change it to

$geoip_path = "GeoLiteCity.dat";

it runs like a charm and like you said it took me around a second to work
bopie is offline
Pricetx
Junior Member
Join Date: Jan 2013
Old 01-29-2016 , 19:33   Re: [SCRIPT] Update GeoIP data for all players in HLX:CE Database
Reply With Quote #3

Quote:
Originally Posted by bopie View Post
This script works perfectly except for one little mistype in it

After

$geoip_path = "GeoLiteCity.dat"

there need to be a

;

so if you change it to

$geoip_path = "GeoLiteCity.dat";

it runs like a charm and like you said it took me around a second to work
Oh, sorry about that, I'm not sure how that got missed when I uploaded it to GitHub. I've now fixed it anyway.

Good to hear it worked for you .
Pricetx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode