vpntest.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # echo "Creating big file to send over"
  3. # dd if=/dev/urandom of=big_file bs=1G count=2 iflag=fullblock
  4. # sha256sum big_file > big_file.sha256
  5. ((count = 100))
  6. while [[ $count -ne 0 ]] ; do
  7. ping -c 1 $1
  8. rc=$?
  9. if [[ $rc -eq 0 ]] ; then
  10. ((count = 1))
  11. fi
  12. ((count = count - 1))
  13. done
  14. if [[ $rc -eq 0 ]] ; then
  15. echo "Alright"
  16. else
  17. echo "Test failed"
  18. exit 1
  19. fi
  20. # host=$1
  21. # if [ "$3" == "download" ]; then
  22. # set -e
  23. # echo "Downloading big file"
  24. # curl -v -L $host/big_file -O big_file
  25. # curl -v -L $host/big_file.sha256 -O big_file.sha256
  26. # echo "Verifying checksum"
  27. # sha256sum -c "big_file.sha256"
  28. # curl -X PUT http://localhost:8080/api/ledger/tests/vpn$2
  29. # sleep 30
  30. # curl -X PUT http://localhost:8080/api/ledger/tests/vpn$2
  31. # sleep 30
  32. # else
  33. # set +e
  34. # ((count = 640))
  35. # while [[ $count -ne 0 ]] ; do
  36. # sleep 5
  37. # curl http://localhost:8080/api/ledger/tests/vpn$1 | grep "24"
  38. # rc=$?
  39. # if [[ $rc -eq 0 ]] ; then
  40. # ((count = 1))
  41. # fi
  42. # ((count = count - 1))
  43. # done
  44. # fi