speedtest.sh 404 B

123456789101112
  1. #!/bin/bash
  2. set -euo pipefail
  3. if [ ! -f noise ]; then
  4. dd if=/dev/urandom bs=1M count=10 of=noise 2>/dev/null
  5. fi
  6. size=$(du noise | awk '{ print $1 }')
  7. start=$(date +%s)
  8. ssh especificosba.com.ar "cat >/dev/null" < noise
  9. finish=$(date +%s)
  10. kbps=$(echo "scale=2; ($size)/($finish-$start)" | bc)
  11. curl -s -i -XPOST 'http://graphs.eba:8086/write?db=curso' --data-binary "speed,type=up value=$kbps" >/dev/null