diff --git a/config.yml b/config.yml index 025bcf38..de7ff554 100644 --- a/config.yml +++ b/config.yml @@ -50,7 +50,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/doc/devel/auth1.config.yml b/doc/devel/auth1.config.yml index 2739c7cd..857861ad 100644 --- a/doc/devel/auth1.config.yml +++ b/doc/devel/auth1.config.yml @@ -51,7 +51,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/doc/devel/auth2.config.yml b/doc/devel/auth2.config.yml index ff0b2db5..33d41b92 100644 --- a/doc/devel/auth2.config.yml +++ b/doc/devel/auth2.config.yml @@ -51,7 +51,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/doc/devel/sequent.config.yml b/doc/devel/sequent.config.yml index 0d6bef8b..83bc6a1e 100644 --- a/doc/devel/sequent.config.yml +++ b/doc/devel/sequent.config.yml @@ -51,7 +51,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/doc/production/config.auth.yml b/doc/production/config.auth.yml index 235ab43e..90b748a0 100644 --- a/doc/production/config.auth.yml +++ b/doc/production/config.auth.yml @@ -51,7 +51,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/doc/production/config.master.yml b/doc/production/config.master.yml index 1160fe38..9f453fec 100644 --- a/doc/production/config.master.yml +++ b/doc/production/config.master.yml @@ -51,7 +51,7 @@ config: # cron tab configuration for base backups base_backups: # number of days base backups are kept/stored (0 means forever) - keep_days: 30 + keep_days: 15 # day of the week that the job should run ( 0-6 for Sunday-Saturday, *, etc ) weekday: '*' # Day of the month the job should run ( 1-31, *, */2, etc ) diff --git a/templates/clean_old_postgres_backups.sh b/templates/clean_old_postgres_backups.sh index f5032817..ed42e7d5 100644 --- a/templates/clean_old_postgres_backups.sh +++ b/templates/clean_old_postgres_backups.sh @@ -31,6 +31,7 @@ DATE_OLDEST=`echo "$DATE_NOW - (24*3600*$KEEP_DAYS)" | bc` LIST_BASE=`ls $BACKUP_DIR/base` LIST_DUMP=`ls $BACKUP_DIR/dump` +LIST_WAL=`ls $BACKUP_DIR/wal` for FNAME in $LIST_BASE do @@ -62,4 +63,16 @@ do fi done -exit 0 \ No newline at end of file +for FNAME in $LIST_WAL +do + # Get file's last modification time in seconds since the epoch + FDATE=`date -r "$BACKUP_DIR/wal/$FNAME" +%s` + + # check date and remove if it's too old + if [ "$DATE_OLDEST" -gt "$FDATE" ]; then + echo "deleting $BACKUP_DIR/wal/$FNAME" + rm -f $BACKUP_DIR/wal/$FNAME + fi +done + +exit 0