]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Automatically download and update GeoIP Databases.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 4 Jan 2015 12:40:34 +0000 (13:40 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 4 Jan 2015 12:40:34 +0000 (13:40 +0100)
config/cron/crontab
src/initscripts/init.d/networking/red.up/99-geoip-database [new file with mode: 0644]

index d78d08f593529a9209499bf3bc7a68777f324dc6..54e9b5fee2a9f55713497d6a90e872eea12a5796 100644 (file)
@@ -57,3 +57,6 @@ HOME=/
 # Re-read firewall rules every Sunday in March, October and November to take care of daylight saving time
 00 3 * 3 0          /usr/local/bin/timezone-transition /usr/local/bin/firewallctrl
 00 2 * 10-11 0      /usr/local/bin/timezone-transition /usr/local/bin/firewallctrl
+
+# Update GeoIP database once a month.
+3 2 1 * * *    [ -f "/var/ipfire/red/active" ] && /usr/local/bin/xt_geoip_update >/dev/null 2>&1
diff --git a/src/initscripts/init.d/networking/red.up/99-geoip-database b/src/initscripts/init.d/networking/red.up/99-geoip-database
new file mode 100644 (file)
index 0000000..020f2fa
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Get the GeoIP database if no one exists yet.
+
+DIR=/usr/share/xt_geoip
+
+found=false
+
+# Check if the directory contains any data.
+for i in $DIR/*; do
+        found=true
+        break
+done
+
+# Download ruleset if none has been found.
+if ! ${found}; then
+       /us/local/bin/xt_geoip_update >/dev/null 2>&1
+fi
+
+exit 0