Merge branch 'master' into feature/tunne_bootstrapscrips
diff --git a/galera/files/bootstrap.sh b/galera/files/bootstrap.sh
index e52b369..34c2b17 100644
--- a/galera/files/bootstrap.sh
+++ b/galera/files/bootstrap.sh
@@ -2,19 +2,18 @@
service {{ service.service }} start
-counter=60
+counter=${1:-120}
retries=0
while [ $counter -gt 0 ]
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)."
exit 0
fi
counter=$(( counter - 1 ))
retries=$(( retries + 1 ))
- sleep 4
+ sleep ${2:-4}
done
echo "Failed to connect to the MySQL service after $retries retries."
diff --git a/galera/files/init_bootstrap.sh b/galera/files/init_bootstrap.sh
index 917c4f0..c168915 100644
--- a/galera/files/init_bootstrap.sh
+++ b/galera/files/init_bootstrap.sh
@@ -2,19 +2,18 @@
service {{ service.service }} start
-counter=60
+counter=${1:-120}
retries=0
while [ $counter -gt 0 ]
do
- mysql -u root -e"quit" || mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"
- if [[ $? -eq 0 ]]; then
+ if mysql -u root -e"quit" || mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"; then
echo "Sucessfully connected to the MySQL service ($retries retries)."
exit 0
fi
counter=$(( counter - 1 ))
retries=$(( retries + 1 ))
- sleep 2
+ sleep ${2:-4}
done
echo "Failed to connect to the MySQL service after $retries retries."