Skip to content

Commit 609dab4

Browse files
committed
Simplify pull_rib.sh, also works on macOS
1 parent 00be47c commit 609dab4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

hack/pull_rib.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
BASE_URL="http://archive.routeviews.org/bgpdata"
5-
TIMESTAMP=$((($(date -u +%s)-3600)/7200*7200))
6-
YEAR=$(date -u -d "@${TIMESTAMP}" +%Y)
7-
MONTH=$(date -u -d "@${TIMESTAMP}" +%m)
8-
FILENAME=$(curl -fsSL "${BASE_URL}/${YEAR}.${MONTH}/RIBS/" | grep -oE 'rib\.[0-9]{8}\.[0-9]{4}\.bz2' | tail -n 1)
9-
wget "${BASE_URL}/${YEAR}.${MONTH}/RIBS/${FILENAME}"
4+
base_url="http://archive.routeviews.org/bgpdata"
5+
filename=$(curl -fsSL "${base_url}/$(date +%Y.%m)/RIBS/" | grep -oE 'rib\.[0-9]{8}\.[0-9]{4}\.bz2' | tail -n 1)
6+
curl -fSLO "${base_url}/$(date +%Y.%m)/RIBS/${filename}"

0 commit comments

Comments
 (0)