File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,25 @@ log () {
5353 echo $message >> /tmp/script.log
5454}
5555
56+ # Function to retry a command based on the return code
57+ # $1: The number of retries
58+ # $2: The command to run
59+ retry () {
60+ local retries=$1
61+ shift
62+ local count=0
63+ until " $@ " ; do
64+ exit_code=$?
65+ count=$(( count + 1 ))
66+ if [ $count -ge $retries ]; then
67+ echo " Command failed after $retries attempts."
68+ return $exit_code
69+ fi
70+ echo " Attempt $count failed. Retrying..."
71+ sleep 5
72+ done
73+ }
74+
5675# ##############################################################
5776# Function to get the current host protocol
5877# $1: The host name
@@ -699,10 +718,10 @@ if [[ "$IS_BOOTSTRAP_HOST" == "true" ]]; then
699718 if [[ " ${MARKLOGIC_CLUSTER_TYPE} " == " bootstrap" ]]; then
700719 log " Info: bootstrap host is ready"
701720 init_security_db
702- configure_group
721+ retry 5 configure_group
703722 else
704723 log " Info: bootstrap host is ready"
705- configure_group
724+ retry 5 configure_group
706725 join_cluster $HOST_FQDN
707726 fi
708727 configure_path_based_routing
You can’t perform that action at this time.
0 commit comments