github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/tests/_utils/start_tls_tidb_cluster (about)

     1  #!/bin/bash
     2  
     3  # --workdir: work directory
     4  # --tlsdir: certificates directory
     5  # --retry: retry times
     6  
     7  set -e
     8  
     9  OUT_DIR=
    10  TLS_DIR=
    11  retry_times=3
    12  
    13  while [[ ${1} ]]; do
    14      case "${1}" in
    15          --workdir)
    16              OUT_DIR=${2}
    17              shift
    18              ;;
    19          --tlsdir)
    20              TLS_DIR=${2}
    21              shift
    22              ;;
    23          --retry)
    24              retry_times=${2}
    25              shift
    26              ;;
    27          *)
    28              echo "Unknown parameter: ${1}" >&2
    29              exit 1
    30      esac
    31  
    32      if ! shift; then
    33          echo 'Missing parameter argument.' >&2
    34          exit 1
    35      fi
    36  done
    37  
    38  CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
    39  source $CUR/../_utils/test_prepare
    40  
    41  set +e
    42  i=1
    43  while [ $i -le $retry_times ]
    44  do
    45      echo "The ${i} times to try to start tls tidb cluster..."
    46  
    47      start_tls_tidb_cluster_impl --workdir ${OUT_DIR} --tlsdir ${TLS_DIR}
    48  
    49      if [ $? -eq 0 ]; then
    50          break
    51      fi
    52      let i++
    53      echo "start tls tidb cluster failed"
    54  done