From 49837807e77b9f94734d289ff441979b3eaf59f6 Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Sun, 3 Dec 2023 14:57:51 +0100 Subject: [PATCH] feature: conditionning dumpall with if-exists --- backup-database.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup-database.sh b/backup-database.sh index 5b81a3a..c8a6489 100755 --- a/backup-database.sh +++ b/backup-database.sh @@ -9,7 +9,7 @@ backUpFilePath="$BACKUP_DESTINATION_FOLDER/$backUpFileName" echo "$dt - Starting DB backup into file: $backUpFilePath"; echo "$dt - Running: pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath" -pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath +pg_dumpall --if-exists -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath if [ $? -ne 0 ]; then rm $backUpFilePath