-
Notifications
You must be signed in to change notification settings - Fork 174
Grab APNIC
w18g edited this page Nov 9, 2015
·
1 revision
This grabs the zipped version of routes from the previous day, which only results in 250kb download (because it is soooo slow). Put this in a crontab to run nightly...
#!/bin/ash
## Yesterday...
year=`env TZ=UTC+24 date +%Y`
day=`env TZ=UTC+24 date +%Y%m%d`
url=ftp://ftp.apnic.net/apnic/stats/apnic/$year/delegated-apnic-$day.gz
## Backup (needed?)
gzip -f /etc/chinadns_chnroute.txt
wget -O- $url | gunzip | awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /etc/chinadns_chnroute.txt