RESOURCES='members councils proposals channels categories threads posts blocks events eras' SLEEP=15 API=/api/v1/ BALANCER=https://api.joystreamstats.live SERVER1=https://frankfurt.api.joystreamstats.live SERVER2=https://helsinki.api.joystreamstats.live CURL_OPTIONS='-s -o NUL -w %{time_total}s' function now { date +%s } while [[ 1 ]] ; do printf "%15s %15s %15s %15s\n" resource balancer frankfurt helsinki for res in $RESOURCES do start=$((now)) printf "Fetching $res" printf "\r%15s %15s %15s %15s" $res \ `curl $BALANCER$API$res $CURL_OPTIONS` \ `curl $SERVER1$API$res $CURL_OPTIONS` \ `curl $SERVER2$API$res $CURL_OPTIONS` printf " %4ds\n" $((now - $start)) echo $start done for res in $RESOURCES do printf "Fetching $res/1" printf "\r%15s %15s %15s %15s\n" "$res (1)" \ `curl $BALANCER$API$res/1 $CURL_OPTIONS` \ `curl $SERVER1$API$res/1 $CURL_OPTIONS` \ `curl $SERVER2$API$res/1 $CURL_OPTIONS` done printf "%30s" "restarting in $SLEEP" sleep $SLEEP printf "\r%30s\n" "" done