#!/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