automatic geoip update

This commit is contained in:
bunkerity
2020-09-18 22:08:52 +02:00
parent 14ec9f3e63
commit bcd17dbea2
5 changed files with 15 additions and 9 deletions

11
scripts/geoip.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# MMDB from https://db-ip.com/db/download/ip-to-country-lite
URL="https://download.db-ip.com/free/dbip-country-lite-$(date +%Y-%m).mmdb.gz"
wget -O /etc/nginx/geoip.mmdb.gz "$URL" > /dev/null 2>&1
if [ -f /etc/nginx/geoip.mmdb.gz ] ; then
gunzip -f /etc/nginx/geoip.mmdb.gz
if [ -f /run/nginx/nginx.pid ] ; then
/usr/sbin/nginx -s reload
fi
fi

View File

@@ -1,8 +0,0 @@
#!/bin/sh
# wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=&suffix=tar.gz" -O toto.tar.gz
wget -O /etc/nginx/geoip.mmdb.gz https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz
gunzip -f /etc/nginx/geoip.mmdb.gz
if [ -f /run/nginx/nginx.pid ] ; then
/usr/sbin/nginx -s reload
fi