How to automate IP2Location BIN database download in Linux

David Cheong
2 min readJun 4, 2020

--

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 https://www.ip2location.com/downloads/automated-ip2location-bin-download-linux.zip
  2. Decompress and edit the download-ip2location-bin.sh with any text editor.
  3. Search for TOKEN=”DOWNLOAD_TOKEN” and replace the “DOWNLOAD_TOEKN” with your token.
  1. Search for DBPATH=”YOUR_DATABASE_LOCATION” and replace the “YOUR_DATABASE_LOCATION” with your database path
  2. Test the script by running ./download-ip2location-bin.sh. 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/download-ip2location-bin.sh

Originally published at https://tech.david-cheong.com on June 4, 2020.

--

--

No responses yet