File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -287,9 +287,14 @@ func DedicatedSnapshotVolumeRestoreCommand(pgdata string, tablespaceVolumes []*c
287287 // Otherwise return 1, Job will fail, and we will not proceed with snapshot.
288288 restoreScript := `declare -r pgdata="$1" opts="$2"
289289BACKUP_LABEL="xxx"
290- if [ -e "` + pgdata + `/backup_label" ]
290+ if [[ -e "` + pgdata + `/backup_label" ] ]
291291then
292- BACKUP_LABEL=$(md5sum ` + pgdata + `/backup_label | awk '{print $1}')
292+ if BACKUP_LABEL=$(md5sum ` + pgdata + `/backup_label); then
293+ BACKUP_LABEL=$(echo "${BACKUP_LABEL}" | awk '{print $1}')
294+ else
295+ echo "Error getting checksum of backup_label."
296+ exit 1
297+ fi
293298fi
294299echo "Starting pgBackRest delta restore"
295300
@@ -299,11 +304,16 @@ bash -xc "pgbackrest restore ${opts}"
299304rm -f "${pgdata}/patroni.dynamic.json"
300305
301306BACKUP_LABEL_POST="xxx"
302- if [ -e "` + pgdata + `/backup_label" ]
307+ if [[ -e "` + pgdata + `/backup_label" ] ]
303308then
304- BACKUP_LABEL_POST=$(md5sum ` + pgdata + `/backup_label | awk '{print $1}')
309+ if BACKUP_LABEL_POST=$(md5sum ` + pgdata + `/backup_label); then
310+ BACKUP_LABEL_POST=$(echo "${BACKUP_LABEL_POST}" | awk '{print $1}')
311+ else
312+ echo "Error getting checksum of backup_label."
313+ exit 1
314+ fi
305315fi
306- if [ "$BACKUP_LABEL" != "$BACKUP_LABEL_POST" ]
316+ if [[ "${ BACKUP_LABEL} " != "${ BACKUP_LABEL_POST}" ] ]
307317then
308318 exit 0
309319fi
You can’t perform that action at this time.
0 commit comments