File tree 1 file changed +15
-5
lines changed
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
287
287
// Otherwise return 1, Job will fail, and we will not proceed with snapshot.
288
288
restoreScript := `declare -r pgdata="$1" opts="$2"
289
289
BACKUP_LABEL="xxx"
290
- if [ -e "` + pgdata + `/backup_label" ]
290
+ if [[ -e "` + pgdata + `/backup_label" ] ]
291
291
then
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
293
298
fi
294
299
echo "Starting pgBackRest delta restore"
295
300
@@ -299,11 +304,16 @@ bash -xc "pgbackrest restore ${opts}"
299
304
rm -f "${pgdata}/patroni.dynamic.json"
300
305
301
306
BACKUP_LABEL_POST="xxx"
302
- if [ -e "` + pgdata + `/backup_label" ]
307
+ if [[ -e "` + pgdata + `/backup_label" ] ]
303
308
then
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
305
315
fi
306
- if [ "$BACKUP_LABEL" != "$BACKUP_LABEL_POST" ]
316
+ if [[ "${ BACKUP_LABEL} " != "${ BACKUP_LABEL_POST}" ] ]
307
317
then
308
318
exit 0
309
319
fi
You can’t perform that action at this time.
0 commit comments