github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/redis/dataprotection/restore.sh (about)

     1  set -e
     2  set -o pipefail
     3  export PATH="$PATH:$DP_DATASAFED_BIN_PATH"
     4  export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH"
     5  mkdir -p ${DATA_DIR}
     6  res=`find ${DATA_DIR} -type f`
     7  data_protection_file=${DATA_DIR}/.kb-data-protection
     8  if [ ! -z "${res}" ] && [ ! -f ${data_protection_file} ]; then
     9    echo "${DATA_DIR} is not empty! Please make sure that the directory is empty before restoring the backup."
    10    exit 1
    11  fi
    12  # touch placeholder file
    13  touch ${data_protection_file}
    14  datasafed pull "${DP_BACKUP_NAME}.tar.gz" - | tar -xzvf - -C ${DATA_DIR}
    15  rm -rf ${data_protection_file} && sync