Auto Update GEO IP AWStats WAMP
Script to Auto Update GEO IP on Windows WAMP (WampServer)
This tutorial is split into five chronological sections:
Pages
Installing AWStats on WAMP
Auto Update AWStats on WAMP
Create Additional AWStats WAMP Profiles
Install GEO IP on AWStats WAMP
Auto Update GEO IP AWStats WAMP
Help Links to AWStats and WAMP
I wrote a script which automatically updates all the databases in c:\wamp\bin\geodata\*.dat. This script can be used on Windows, for any type installation,i.e. WAMP (WampServer), IIS, etc.. The script, first downloads the compressed data, extracts the data, and overwrites the old data with the new updated version, and finally it deletes the zipped archive. It will do this every month, or however many times you schedule the script to run. It utilizes some very useful programs, like 7zip which is a better Open Source alternative to the commercial WinZip. Wget.exe is also used to download the compressed archives. Both tools are important assets to add to your arsenal of web development tools.
Automatically update your GEO IP data with the latest information.
Step 1:
Download and install 7zip for Windows:
Download from http://www.7-zip.org/download.html
Select latest version, and use the installer’s default location, i.e. C:\Program Files\7-Zip
Right click on “My Computer”, select Properties, select Advanced Properties, click on Environmental Variables and under System variables scroll down and double click on PATH, and enter the following line after all the other variables:
C:\Program Files\7-Zip
Step 2:
Download and install wget for Windows (win32 version):
Download wget.exe from http://users.ugent.be/~bpuype/wget/Save it in, like so:
c:\WINDOWS\wget.exe
Step 3:
Create a new directory and name it, tasks, like so:
c:\wamp\tasksStep 4:
Create a blank text file and rename it to update_geodata.bat, in the following directory like so:
c:\wamp\tasks\update_geodata.bat
Step 5:
Edit update_geodata.bat, by right clicking the file and selecting edit with notepad, open with, or open with any simple text editor. Copy and paste the following:
@ECHO OFF REM script instructions http://webdevster.com/how-to/auto-update-geo-ip-awstats-on-windows-wamp set updatepath="c:\wamp\bin\geodata" REM download databases into update directory wget.exe --limit-rate=100k --output-document="%updatepath%\GeoIP.dat.gz" "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" wget.exe --limit-rate=100k --output-document="%updatepath%\GeoIPASNum.dat.gz" "http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz" wget.exe --limit-rate=200k --output-document="%updatepath%\GeoLiteCity.dat.gz" "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" REM uncompress downloaded files start /B "Unompressing databases…" /min /wait 7z.exe e "%updatepath%\*.gz" -o"%updatepath%\" REM force delete downloaded files ECHO Y | DEL /F /Q %updatepath%\*.gz
If you have followed, my tutorial for installing WampServer and GEO IP, then there is no need to edit this script. However, if you have created another location to store your GEO Data, than I have conveniently written the script, so you can edit the path. Edit, c:\wamp\bin\geodata to reflect your update path.
Step 6:
Create a blank text file and rename it to update_geodata.vbs, in the following directory like so:
c:\wamp\tasks\update_geodata.vbs
Step 7:
Edit update_geodata.vbs, by right clicking the file and selecting edit with notepad, open with, or open with any simple text editor. Copy and paste the following:
Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "c:\wamp\tasks\update_geodata.bat" & Chr(34), 0 Set WshShell = Nothing
Alternatley you can download the zip containing both of these files here.
Step 8:
Create a Windows Schedule in Control Panel > Scheduled Tasks to run, update_geodata.vbs every month or quarterly.
Essentially, this script will run silent (invisible) without any annoying cmd popup windows. And as a courtesy to MaxMind Open Source, will limit the burst download speed to lift some of the bandwidth burden off the geolite.maxmind.com server. If you would like to test the script, simply double click the update_geodata.bat file. You will see the progress in the cmd window, which pops up. Also, if you like you can also simply run this script manually without scheduling a task.


















" Auto Update GEO IP AWStats on Windows WAMP "
Works PERFECTLY. Thanks!