aboutsummaryrefslogtreecommitdiffstats
path: root/main/ntop/ntop-update-geoip-db
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@gmail.com>2010-10-26 09:40:33 +0000
committerLeonardo Arena <rnalrd@gmail.com>2010-10-26 09:40:33 +0000
commit6d260f6fcc07a1b0ae6b34a0c07d1668fcf08556 (patch)
tree9af4cf760b25189dd9aac1119b9b02adbc98b09d /main/ntop/ntop-update-geoip-db
parenteb4656448c5960be15d07fd4e6da8fc0899a6367 (diff)
downloadaports-6d260f6fcc07a1b0ae6b34a0c07d1668fcf08556.tar.bz2
aports-6d260f6fcc07a1b0ae6b34a0c07d1668fcf08556.tar.xz
testing/ntop: moved to main
Diffstat (limited to 'main/ntop/ntop-update-geoip-db')
-rw-r--r--main/ntop/ntop-update-geoip-db21
1 files changed, 21 insertions, 0 deletions
diff --git a/main/ntop/ntop-update-geoip-db b/main/ntop/ntop-update-geoip-db
new file mode 100644
index 0000000000..2bf3faaf68
--- /dev/null
+++ b/main/ntop/ntop-update-geoip-db
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+BASE_URL=http://geolite.maxmind.com/download/geoip/database
+
+echo "Updating NTOP GeoIP databases..."
+
+cd /var/lib/ntop || exit
+
+for u in asnum/GeoIPASNum.dat.gz GeoLiteCity.dat.gz ; do
+ FILE_GZ=${u#*/}
+ FILE=${FILE_GZ%.gz}
+ wget -nv -O ${FILE_GZ} ${BASE_URL}/${u} &&
+ gunzip < ${FILE_GZ} > .${FILE} &&
+ mv -f .${FILE} ${FILE} &&
+ rm -f ${FILE_GZ} ||
+ exit
+done
+
+/etc/init.d/ntop --quiet status && /etc/init.d/ntop restart
+
+echo "NTOP GeoIP databases were successfully updated"