瀏覽代碼

Tunne bootstrap scripts

feature/tunne_bootstrapscrips
Petr Michalec 7 年之前
父節點
當前提交
e8d39b6576
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 8 行新增10 行删除
  1. +4
    -5
      galera/files/bootstrap.sh
  2. +4
    -5
      galera/files/init_bootstrap.sh

+ 4
- 5
galera/files/bootstrap.sh 查看文件

#!/bin/bash
#!/bin/sh


service {{ service.service }} start service {{ service.service }} start


counter=60
counter=${1:-60}
retries=0 retries=0


while [ $counter -gt 0 ] while [ $counter -gt 0 ]
do do
mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"
if [[ $? -eq 0 ]]; then
if mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"; then
echo "Sucessfully connected to the MySQL service ($retries retries)." echo "Sucessfully connected to the MySQL service ($retries retries)."
exit 0 exit 0
fi fi
counter=$(( counter - 1 )) counter=$(( counter - 1 ))
retries=$(( retries + 1 )) retries=$(( retries + 1 ))
sleep 4
sleep ${2:-4}
done done


echo "Failed to connect to the MySQL service after $retries retries." echo "Failed to connect to the MySQL service after $retries retries."

+ 4
- 5
galera/files/init_bootstrap.sh 查看文件

#!/bin/bash
#!/bin/sh


service {{ service.service }} start service {{ service.service }} start


counter=60
counter=${1:-60}
retries=0 retries=0


while [ $counter -gt 0 ] while [ $counter -gt 0 ]
do do
mysql -u root -e"quit"
if [[ $? -eq 0 ]]; then
if mysql -u root -e"quit"; then
echo "Sucessfully connected to the MySQL service ($retries retries)." echo "Sucessfully connected to the MySQL service ($retries retries)."
exit 0 exit 0
fi fi
counter=$(( counter - 1 )) counter=$(( counter - 1 ))
retries=$(( retries + 1 )) retries=$(( retries + 1 ))
sleep 2
sleep ${2:-4}
done done


echo "Failed to connect to the MySQL service after $retries retries." echo "Failed to connect to the MySQL service after $retries retries."

Loading…
取消
儲存