Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/msimerson/maxmind-geolite-mirror/llms.txt

Use this file to discover all available pages before exploring further.

MaxMind publishes updated GeoLite2 databases every Tuesday. Running maxmind-geolite-mirror on a schedule ensures your local copies stay current without manual intervention. Because the tool uses conditional HTTP requests, running it more frequently than necessary is safe — it only downloads a database when the remote copy is newer than what you already have.

Editing the crontab

Open the current user’s crontab for editing:
crontab -e

Weekly cron entry

The following entry runs the mirror every Wednesday at 03:00, giving MaxMind’s Tuesday release a few hours to propagate before you fetch it:
0 3 * * 3 MAXMIND_LICENSE_KEY=your_key_here /usr/local/bin/maxmind-geolite-mirror

Environment limitations

cron does not source your shell profile (~/.bashrc, ~/.profile, etc.), so environment variables exported there are not available to cron jobs. The simplest fix is to pass variables inline in the cron entry itself, as shown above. For more complex setups, a wrapper script keeps the cron entry clean.

Wrapper script approach

Create a shell script that sets all required environment variables, then call that script from cron:
wrapper.sh
#!/bin/bash
export MAXMIND_LICENSE_KEY=your_key_here
export MAXMIND_DB_DIR=/usr/local/share/GeoIP
/usr/local/bin/maxmind-geolite-mirror
Make the script executable:
chmod +x /path/to/wrapper.sh
Simplified cron entry:
0 3 * * 3 /path/to/wrapper.sh
cron jobs capture stdout and stderr only if you redirect them explicitly. To retain a log for debugging, append output to a file:
0 3 * * 3 /path/to/wrapper.sh >> /var/log/maxmind-geolite-mirror.log 2>&1
Because maxmind-geolite-mirror only downloads a database when the remote copy is newer than your local file (HTTP 304 means skip), it is safe to schedule the tool more aggressively — for example daily — without incurring unnecessary bandwidth or MaxMind API calls. Only changed files are ever downloaded.

Build docs developers (and LLMs) love