diff --git a/misc/update-mmdb.sh b/misc/update-mmdb.sh index f282d564f..cd1c56cca 100755 --- a/misc/update-mmdb.sh +++ b/misc/update-mmdb.sh @@ -13,6 +13,12 @@ if [ $? -ne 0 ]; then exit 1 fi +content_head="$(head -n 2 asn.mmdb.gz)" +if [[ "$content_head" =~ "404 Not Found" ]]; then + echo "❌ The ASN database is not available for the current month for the moment." + exit 1 +fi + curl -o country.mmdb.gz "https://download.db-ip.com/free/dbip-country-lite-$(date +%Y-%m).mmdb.gz" # shellcheck disable=SC2181 if [ $? -ne 0 ]; then @@ -20,6 +26,12 @@ if [ $? -ne 0 ]; then exit 1 fi +content_head="$(head -n 2 country.mmdb.gz)" +if [[ "$content_head" =~ "404 Not Found" ]]; then + echo "❌ The country database is not available for the current month for the moment." + exit 1 +fi + # Decompress the downloaded databases gunzip -f asn.mmdb.gz