feature: purge backup older than 14 days
All checks were successful
Main / build (push) Successful in 7m35s
All checks were successful
Main / build (push) Successful in 7m35s
This commit is contained in:
parent
49837807e7
commit
d795a16421
@ -7,6 +7,7 @@ RUN localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8
|
||||
RUN apt update && apt install pgtop
|
||||
|
||||
ENV LANG fr_FR.utf8
|
||||
ENV PURGE_OLD false
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
|
@ -6,6 +6,13 @@ fileDt=$(date '+%d_%m_%Y_%H_%M_%S');
|
||||
backUpFileName="postgres-backup-$fileDt.gz"
|
||||
backUpFilePath="$BACKUP_DESTINATION_FOLDER/$backUpFileName"
|
||||
|
||||
if $PURGE_OLD; then DRY_RUN=false; else DRY_RUN=true; fi
|
||||
echo "Following file are older than 14 day, it will be deleted (dry-run $DRY_RUN)"
|
||||
find /var/lib/backup/ -type f -mtime +14 -name '*.gz' -execdir ls -- '{}' \;
|
||||
if [ $PURGE_OLD = true ]; then
|
||||
find /var/lib/backup/ -type f -mtime +14 -name '*.gz' -execdir rm -- '{}' \;
|
||||
fi
|
||||
|
||||
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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user