libloc: Only update database once a week

Ensure to download and update the database only once a week, even the
script will be called by cron each hour.

Fixes #12462.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Stefan Schantl
2020-07-29 18:57:43 +02:00
committed by Arne Fitzenreiter
parent 18f0510429
commit 99659ce50b
3 changed files with 26 additions and 1 deletions

View File

@@ -21,6 +21,8 @@
eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings)
UPDATE_INTERVAL="weekly"
# Proxy settings.
# Check if a proxy should be used.
if [[ $UPSTREAM_PROXY ]]; then
@@ -39,7 +41,7 @@ if [[ $UPSTREAM_PROXY ]]; then
fi
# Get the latest location database from server.
if /usr/bin/location update; then
if /usr/bin/location update --cron=$UPDATE_INTERVAL; then
# Call location and export all countries in xt_geoip compatible format.
if /usr/bin/location export --directory=/usr/share/xt_geoip --family=ipv4 --format=xt_geoip; then