aboutsummaryrefslogtreecommitdiffstats
path: root/main/ntop/ntop-update-geoip-db
blob: 2bf3faaf68cb95ffa9cc5d4e28adf7ccde2fe3c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"