ploadstart.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. set -e
  3. msg_count=""
  4. msg_size=""
  5. usage() {
  6. echo "ploadstart [options]"
  7. echo ""
  8. echo "Options:"
  9. echo " -c msg_count Number of messages to send (max UINT32_T default 1500000)"
  10. echo " -s msg_size Size of messages in bytes (max 1000000 default 300)"
  11. echo " -h display this help"
  12. }
  13. while getopts "hs:c:" optflag; do
  14. case "$optflag" in
  15. h)
  16. usage
  17. exit 0
  18. ;;
  19. c)
  20. msg_count="$OPTARG"
  21. ;;
  22. s)
  23. msg_size="$OPTARG"
  24. ;;
  25. \?|:)
  26. usage
  27. exit 1
  28. ;;
  29. esac
  30. done
  31. [ -n "$msg_count" ] && corosync-cmapctl -s pload.count u32 $msg_count
  32. [ -n "$msg_size" ] && corosync-cmapctl -s pload.size u32 $msg_size
  33. echo "***** WARNING *****"
  34. echo ""
  35. echo "Running pload test will kill your cluster and all corosync daemons will exit"
  36. echo "at the end of the load test"
  37. echo ""
  38. echo "***** END OF WARNING *****"
  39. echo ""
  40. echo "YOU HAVE BEEN WARNED"
  41. echo ""
  42. echo "If you agree, and want to proceed, please type:"
  43. echo "Yes, I fully understand the risks of what I am doing"
  44. echo ""
  45. read -p "type here: " ans
  46. [ "$ans" = "Yes, I fully understand the risks of what I am doing" ] || {
  47. echo "Wise choice.. or you simply didn't type it right"
  48. exit 0
  49. }
  50. corosync-cmapctl -s pload.start str i_totally_understand_pload_will_crash_my_cluster_and_kill_corosync_on_exit
  51. echo "PLOAD started, please see corosync.log for final results"