aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/ntopng/ntopng-update-geoip-db
blob: 1ac05bc0e036321a6ab5167cad669189abf0a9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

BASE_URL=http://geolite.maxmind.com/download/geoip/database

echo "Updating NTOP GeoIP databases..."

cd /usr/share/ntopng/geoip || exit

for u in \
	asnum/GeoIPASNum.dat.gz \
	asnum/GeoIPASNumv6.dat.gz \
	GeoLiteCity.dat.gz \
	GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz; do
	FILE_GZ=${u#*/}
	FILE=${FILE_GZ%.gz}
	wget -O ${FILE_GZ} ${BASE_URL}/${u} &&
		gunzip < ${FILE_GZ} > .${FILE} &&
		mv -f .${FILE} ${FILE} &&
		rm -f ${FILE_GZ} ||
		exit
done

rc-service ntopng status && rc-service ntopng restart

echo "NTOP GeoIP databases were successfully updated"