Patrick B
2016-07-31 22:11:43 UTC
Hi all,
I want to hold the wal_files for 30 days on my slaves.
For that reason, I created a script to do that:
*pg_archivecleaup_mv.bash:*
#!/bin/bash -eu
declare -r -x PATH='/usr/local/bin:/usr/bin:/bin';
# We just wanna delete the wal_files older than 30 days
ARCHIVEDIR='/var/lib/pgsql/9.2/archive/'
CHKPOINT=$(find $ARCHIVEDIR -type f -mtime +30 -name '00*' -printf '%f\n' |
sort -r | head -1)
cd $ARCHIVEDIR
/usr/pgsql-${PG_VERSION}/bin/pg_archivecleanup $ARCHIVEDIR $CHKPOINT
find $ARCHIVEDIR -type f -mtime +30 -a -name '00*' -a ! -newer $CHKPOINT
-delete
*recovery.conf:*
archive_cleanup_command = 'exec nice -n 19 ionice -c 2 -n 7
../../bin/pg_archivecleaup_mv.bash -d /var/lib/pgsql/9.2/archive "%r"'
*PROBLEM:*
Please, do you guys can help?
Cheers;
Patrick
I want to hold the wal_files for 30 days on my slaves.
For that reason, I created a script to do that:
*pg_archivecleaup_mv.bash:*
#!/bin/bash -eu
declare -r -x PATH='/usr/local/bin:/usr/bin:/bin';
# We just wanna delete the wal_files older than 30 days
ARCHIVEDIR='/var/lib/pgsql/9.2/archive/'
CHKPOINT=$(find $ARCHIVEDIR -type f -mtime +30 -name '00*' -printf '%f\n' |
sort -r | head -1)
cd $ARCHIVEDIR
/usr/pgsql-${PG_VERSION}/bin/pg_archivecleanup $ARCHIVEDIR $CHKPOINT
find $ARCHIVEDIR -type f -mtime +30 -a -name '00*' -a ! -newer $CHKPOINT
-delete
*recovery.conf:*
archive_cleanup_command = 'exec nice -n 19 ionice -c 2 -n 7
../../bin/pg_archivecleaup_mv.bash -d /var/lib/pgsql/9.2/archive "%r"'
*PROBLEM:*
pg_archivecleanup: must specify restartfilename
Try "pg_archivecleanup --help" for more information.
archive_cleanup_command "exec nice -n 19 ionice -c 2 -n 7
../../bin/pg_archivecleaup_mv.bash -d "../archive" "%r"": return code 512
And I can't figure out what is wrong....Try "pg_archivecleanup --help" for more information.
archive_cleanup_command "exec nice -n 19 ionice -c 2 -n 7
../../bin/pg_archivecleaup_mv.bash -d "../archive" "%r"": return code 512
Please, do you guys can help?
Cheers;
Patrick