File: xt_geoip_dl

package info (click to toggle)
xtables-addons 3.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,492 kB
  • sloc: ansic: 10,713; sh: 4,481; perl: 356; makefile: 143; python: 15
file content (12 lines) | stat: -rwxr-xr-x 383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

# try to download this month file
timestamp=$(date "+%Y-%m")
wget -q "https://download.db-ip.com/free/dbip-country-lite-$timestamp.csv.gz" -O- | \
	gzip -cd >dbip-country-lite.csv

if [ $? -ne 0 ]; then
  timestamp=$(date -d '-1 month' "+%Y-%m")
  wget -q "https://download.db-ip.com/free/dbip-country-lite-$timestamp.csv.gz" -O- | \
  	gzip -cd >dbip-country-lite.csv
fi