mirror of
https://github.com/lichess-org/lila.git
synced 2026-05-26 13:51:00 +00:00
cron/geoip-update-db.sh
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Use .env file, if it exists.
|
||||
if test -f .env; then
|
||||
export $(egrep -v '^#' .env | xargs)
|
||||
fi
|
||||
|
||||
mkdir -p data
|
||||
cd data
|
||||
curl -L https://download.maxmind.com/app/geoip_download\?edition_id\=GeoLite2-City\&license_key\=$MAXMIND_KEY\&suffix\=tar.gz -o GeoLite2-City.mmdb.tar.gz
|
||||
tar xvzf GeoLite2-City.mmdb.tar.gz
|
||||
mv GeoLite2-City_*/GeoLite2-City.mmdb ./
|
||||
rm -rf GeoLite2-City_*
|
||||
cd -
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
LILA_DIR="$(dirname -- $0)/.."
|
||||
DATA_DIR="$LILA_DIR/data"
|
||||
TGZ_FILE="GeoLite2-City.mmdb.tar.gz"
|
||||
|
||||
if [ -z "$MAXMIND_KEY" ]; then
|
||||
echo "MAXMIND_KEY is not set, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Downloading GeoLite2-City database to $DATA_DIR/$TGZ_FILE"
|
||||
|
||||
mkdir -p $DATA_DIR
|
||||
cd $DATA_DIR
|
||||
curl -L https://download.maxmind.com/app/geoip_download\?edition_id\=GeoLite2-City\&license_key\=$MAXMIND_KEY\&suffix\=tar.gz -o $TGZ_FILE
|
||||
tar xvzf $TGZ_FILE
|
||||
mv GeoLite2-City_*/GeoLite2-City.mmdb ./
|
||||
rm -rf GeoLite2-City_*
|
||||
cd -
|
||||
Reference in New Issue
Block a user