1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-02-15 13:33:21 +02:00

Keep one more WAL archive, to enable single-last backup recovery

This commit is contained in:
Tim Möhlmann 2018-11-30 18:12:23 +02:00
parent 44dae7353c
commit bdcf69b0e6
No known key found for this signature in database
GPG Key ID: 8677988D8072E8DE

View File

@ -17,14 +17,12 @@ done
# Clean the wall archive
cd /backup/wal_archive || exit $?
if [ $(ls *.*.backup | wc -l) -lt 2 ]; then
ls /backup/wal_archive
exit 0
fi
# Find the single last wal.backup point
prev_wal_start="$(ls *.*.backup | tail -n2 | head -n1)"
prev_wal_start="$(ls *.*.backup | tail -n2 | head -n1 | cut -d '.' -f 1)"
for f in $(ls) ; do
if [ "$f" \< "$prev_wal_start" ] || [ "$f" \= "$prev_wal_start" ]; then
if [ "$f" \< "$prev_wal_start" ]; then
rm -v /backup/wal_archive/$f
fi
done
ls /backup/wal_archive