From c547abe3e4ae802d94b3702a925e743bf8c35df5 Mon Sep 17 00:00:00 2001 From: Rob Nickmans Date: Tue, 17 Sep 2024 00:29:11 +0200 Subject: [PATCH 1/2] fix: wrong regex for wal retention --- postgres-appliance/scripts/postgres_backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres-appliance/scripts/postgres_backup.sh b/postgres-appliance/scripts/postgres_backup.sh index 3216ae4ed..46a19d95b 100755 --- a/postgres-appliance/scripts/postgres_backup.sh +++ b/postgres-appliance/scripts/postgres_backup.sh @@ -55,7 +55,7 @@ while read -r name last_modified rest; do # count how many backups will remain after we remove everything up to certain date ((LEFT=LEFT+1)) fi -done < <($WAL_E backup-list 2> /dev/null | sed '0,/^name\s*\(last_\)\?modified\s*/d') +done < <($WAL_E backup-list 2> /dev/null | sed '0,/^backup_name\s*\(last_\)\?modified\s*/d') # we want keep at least N backups even if the number of days exceeded if [ -n "$BEFORE" ] && [ $LEFT -ge $DAYS_TO_RETAIN ]; then From d0b11881944d1596261bbf31696a3b9337612ca6 Mon Sep 17 00:00:00 2001 From: Rob Nickmans Date: Sun, 27 Oct 2024 00:17:32 +0200 Subject: [PATCH 2/2] fix: backwards compatibility with wal-e --- postgres-appliance/scripts/postgres_backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres-appliance/scripts/postgres_backup.sh b/postgres-appliance/scripts/postgres_backup.sh index 46a19d95b..9b9a4723a 100755 --- a/postgres-appliance/scripts/postgres_backup.sh +++ b/postgres-appliance/scripts/postgres_backup.sh @@ -55,7 +55,7 @@ while read -r name last_modified rest; do # count how many backups will remain after we remove everything up to certain date ((LEFT=LEFT+1)) fi -done < <($WAL_E backup-list 2> /dev/null | sed '0,/^backup_name\s*\(last_\)\?modified\s*/d') +done < <($WAL_E backup-list 2> /dev/null | sed '0,/^\(backup_\)\?name\s*\(last_\)\?modified\s*/d') # we want keep at least N backups even if the number of days exceeded if [ -n "$BEFORE" ] && [ $LEFT -ge $DAYS_TO_RETAIN ]; then