Merge ~foli/postgresql-charm:rt101291 into postgresql-charm:master

Proposed by Michael Foley
Status: Merged
Merged at revision: 164b3dfe8c5f18fd58f7ff69d9cf932c1deb3a68
Proposed branch: ~foli/postgresql-charm:rt101291
Merge into: postgresql-charm:master
Diff against target: 19 lines (+2/-2)
1 file modified
templates/pg_backup_job.tmpl (+2/-2)
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Barry Price Approve
Review via email: mp+321796@code.launchpad.net

Description of the change

fix pg_backup_job to correctly follow symlinks when pruning backup files

To post a comment you must log in.
Revision history for this message
Barry Price (barryprice) wrote :

Makes sense, +1

review: Approve
Revision history for this message
Stuart Bishop (stub) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/templates/pg_backup_job.tmpl b/templates/pg_backup_job.tmpl
2index 96aa776..9a4066a 100644
3--- a/templates/pg_backup_job.tmpl
4+++ b/templates/pg_backup_job.tmpl
5@@ -84,13 +84,13 @@ nice -n 19 ${SCRIPTS}/dump-pg-db --dir=${DUMP_DIR} --compression=postgres ${DATA
6 # - Delete anything beyond $FILES count of each backup
7
8 # get name/size of the globals dump from $FILES runs ago
9-THRESHOLD_GLOBALS_DUMP=$(find ${DUMP_DIR} -not \( -path ${DUMP_DIR}/lost+found -prune \) -type f -name 'globals.*.sql' | sort | tail -${FILES}| head -1)
10+THRESHOLD_GLOBALS_DUMP=$(find ${DUMP_DIR}/ -not \( -path ${DUMP_DIR}/lost+found -prune \) -type f -name 'globals.*.sql' | sort | tail -${FILES}| head -1)
11 TIME_NOW=$(date +%s)
12 TIME_DUMP=$(date +%s -r $THRESHOLD_GLOBALS_DUMP)
13 THRESHOLD_AGE=$(($TIME_NOW - $TIME_DUMP))
14 THRESHOLD_MINS=$(($THRESHOLD_AGE / 60))
15 THRESHOLD_MINS=$(($THRESHOLD_MINS + 1)) # always round up
16-find ${DUMP_DIR} -not \( -path ${DUMP_DIR}/lost+found -prune \) -type f -mmin +${THRESHOLD_MINS} -print0 | xargs -0 rm -f
17+find ${DUMP_DIR}/ -not \( -path ${DUMP_DIR}/lost+found -prune \) -type f -mmin +${THRESHOLD_MINS} -print0 | xargs -0 rm -f
18
19 echo backups completed $(date)
20

Subscribers

People subscribed via source and target branches

to all changes: