Saltstack Official Galera Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 satır
655B

  1. #!/bin/bash
  2. service {{ service.service }} start
  3. counter=${1:-60}
  4. retries=0
  5. sst_in_progress='/var/lib/mysql/sst_in_progress'
  6. while [ $counter -gt 0 ]
  7. do
  8. if mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"; then
  9. echo "Sucessfully connected to the MySQL service ($retries retries)."
  10. exit 0
  11. fi
  12. counter=$(( counter - 1 ))
  13. retries=$(( retries + 1 ))
  14. {%- if slave %}
  15. if [ $retries -gt 20 ]; then
  16. if [ ! -e $sst_in_progress ]; then
  17. echo "No sst is in progress."
  18. break
  19. fi
  20. fi
  21. {%- endif %}
  22. sleep ${2:-10}
  23. done
  24. echo "Failed to connect to the MySQL service after $retries retries."
  25. exit 1