How to automate IP2Location BIN database download in Linux

IP2Location is one of the top IP database provider in the world as their database is being updated every 1st day of the month, in order to make use the latest database to keep data up to date, we may need to download, extract and import the database to our system.

Thanks for the automation features, where we can easily schedule the download using the Cronjob, than use the shell script to automate this task to save our life.

This post only work for the paid customer where already subscribe their service, only with the Download Token given, than only you able to do the automation.

For those paid customer, you may login to your IP2Location account, than go to Download page, from here, you may get your Download Token.

  1. Download the automation package from
  2. Decompress and edit the with any text editor.
  3. Search for TOKEN=”DOWNLOAD_TOKEN” and replace the “DOWNLOAD_TOEKN” with your token.

  1. Search for CODE=”DB24BIN” and replace with the code found in the download page. If you wish to check for both IPv4 and IPv6 database, just download the IPv6 will do, as it’s already include both database inside.
  1. Search for DBPATH=”YOUR_DATABASE_LOCATION” and replace the “YOUR_DATABASE_LOCATION” with your database path
  2. Test the script by running ./ The database in the given path should be replace with the latest version from IP2Location.
  3. Once everything is ready and working fine, you may setup the cronjob for the monthly updates.
  4. Add the following line into the end of your content. The following line means it will execute the download and update at 0815 on the 1st of every calendar month.

15 8 1 * * bash /path/to/

Leave a Reply, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: