Never miss a monthly update again. This tutorial guides you through automating the download process for both IP2Location LITE and commercial BIN databases.
Depending on your operating system, follow the instructions below to set up automated downloads using Crontab (Linux/Unix/macOS) or Task Scheduler (Windows).
Linux / Unix / macOS Environment (Using Crontab) #
Step 1: Download and Configure the Script #
- Download the Linux automation package from IP2Location.
- Extract the ZIP file and open
download-ip2location-bin.shin any text editor. - Update the following configuration variables inside the script:
TOKEN="DOWNLOAD_TOKEN": ReplaceDOWNLOAD_TOKENwith your personal token (found in your IP2Location account area).CODE="DB24BIN": ReplaceDB24BINwith the specific database code you want to download.DBPATH="YOUR_DATABASE_LOCATION": ReplaceYOUR_DATABASE_LOCATIONwith the absolute path where you want to store the database.
Step 2: Test the Script #
Run the script manually in your terminal to ensure it works:
./download-ip2location-bin.sh
Check your destination path; the database should successfully update to the latest version.
Step 3: Schedule the Automation #
- Open the cron table file for editing: sudo nano /etc/crontab
- Add the following line to the bottom of the file to run the script on the 1st of every month:
15 8 1 * * bash /path/to/download-ip2location-bin.sh
💡 Tip: To avoid server congestion and ensure faster download speeds, consider changing the execution time to an odd minute/hour (e.g.,
04 8 1 * *for 8:04 AM, or25 9 1 * *for 9:25 AM).
Windows Environment (Using Task Scheduler) #
Step 1: Download and Configure the Batch File #
- Download the Windows automation package from IP2Location.
- Extract the ZIP file and open
download-ip2location-bin.batin a text editor (like Notepad). - Update the following configuration lines:
SET TOKEN=DOWNLOAD_TOKEN: ReplaceDOWNLOAD_TOKENwith your personal download token.SET CODE=DB24BIN: ReplaceDB24BINwith your desired database download code.SET FINALFOLDER=%ROOT%ip2location: Replace%ROOT%ip2locationwith your target database folder path.
Step 2: Test the Script #
Double-click download-ip2location-bin.bat. Verify that the latest database file downloads successfully into your designated folder.
Step 3: Schedule the Automation #
- Open the Start Menu, search for Task Scheduler, and open it.
- In the right-hand Actions pane, click Create Task.
- General Tab: Enter a memorable name for the task (e.g., “IP2Location Auto Update”).
- Triggers Tab: Click New…, set the task to run Monthly, and choose your preferred day of the month.
- Actions Tab: Click New…, set the action to Start a program, browse and select your edited
download-ip2location-bin.batfile, and click OK.
💡 Tip: Just like with Linux, schedule the task for an odd time (e.g., 8:04 AM or 9:25 AM) to prevent download delays due to peak network traffic.
