Skip to content

Commit 06d43d5

Browse files
committed
Fix scripts for Watson Discovery 4.7.0 on CP4D
1 parent 168a955 commit 06d43d5

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

discovery-data/latest/src/minio-backup-restore-in-pod.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if [ "${COMMAND}" = "backup" ] ; then
7171
set +e
7272
while true;
7373
do
74-
${MC} "${MC_OPTS[@]}" --quiet mirror "${MC_MIRROR_OPTS[@]}" ${EXTRA_MC_MIRROR_COMMAND} wdminio/${bucket} ${MINIO_BACKUP_DIR}/${bucket} 2>&1
74+
${MC} "${MC_OPTS[@]}" --quiet mirror ${MC_MIRROR_OPTS[@]} ${EXTRA_MC_MIRROR_COMMAND} wdminio/${bucket} ${MINIO_BACKUP_DIR}/${bucket} 2>&1
7575
RC=$?
7676
echo "RC=${RC}"
7777
if [ $RC -eq 0 ] ; then
@@ -89,7 +89,6 @@ fi
8989

9090
# restore
9191
if [ "${COMMAND}" = "restore" ] ; then
92-
MC_MIRROR_OPTS=( "${MC_MIRROR_OPTS[@]}" "--recursive" )
9392
if [ -z ${MINIO_BACKUP} ] ; then
9493
printUsage
9594
fi
@@ -119,18 +118,28 @@ if [ "${COMMAND}" = "restore" ] ; then
119118
fi
120119
brlog "INFO" " Restore ${bucket}"
121120
set +e
121+
if [[ ${S3_ENDPOINT_URL} == *"minio"* ]] ; then
122+
MC_MIRROR_OPTS=( ${MC_MIRROR_OPTS[@]} "--recursive" )
123+
MC_MIRROR_COMMAND="cp"
124+
else
125+
MC_MIRROR_COMMAND="mirror"
126+
fi
122127
while true;
123128
do
124-
${MC} "${MC_OPTS[@]}" --quiet cp "${MC_MIRROR_OPTS[@]}" ${TMP_WORK_DIR}/${MINIO_BACKUP_DIR}/${bucket}/ wdminio/${bucket}/ 2>&1
129+
${MC} "${MC_OPTS[@]}" ${MC_MIRROR_COMMAND} --quiet ${MC_MIRROR_OPTS[@]} ${TMP_WORK_DIR}/${MINIO_BACKUP_DIR}/${bucket}/ wdminio/${bucket}/ 2>&1
125130
RC=$?
126131
echo "RC=${RC}"
127132
if [ $RC -eq 0 ] ; then
128-
MC_MIRROR_OPTS=( "${MC_MIRROR_OPTS[@]/--continue}" )
133+
if [[ ${S3_ENDPOINT_URL} == *"minio"* ]] ; then
134+
MC_MIRROR_OPTS=( "${MC_MIRROR_OPTS[@]/--continue}" )
135+
fi
129136
break
130137
else
131-
# Add --continue option to resume
132-
if [[ ! " ${MC_MIRROR_OPTS[*]} " =~ " --continue " ]]; then
133-
MC_MIRROR_OPTS+=( "--continue" )
138+
if [[ ${S3_ENDPOINT_URL} == *"minio"* ]] ; then
139+
# Add --continue option to resume. This is available for only MinIO.
140+
if [[ ! " ${MC_MIRROR_OPTS[*]} " =~ " --continue " ]]; then
141+
MC_MIRROR_OPTS+=( "--continue" )
142+
fi
134143
fi
135144
fi
136145
brlog "WARN" "Some file could not be transfered. Retrying..."

0 commit comments

Comments
 (0)