script to start basebackup and wal clean up fto backuppc #2
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
su - postgres -c "/usr/local/sbin/postgresql_wal_backup_and_removal > /var/log/postgresql/wal_removal.log 2>&1"
|
||||||
|
|
|
@ -117,6 +117,11 @@
|
||||||
|
|
||||||
- name: Install a script that cleans up the wal log archives
|
- name: Install a script that cleans up the wal log archives
|
||||||
template: src=postgresql_wal_backup_and_removal.j2 dest=/usr/local/sbin/postgresql_wal_backup_and_removal owner=root group=root mode=0755
|
template: src=postgresql_wal_backup_and_removal.j2 dest=/usr/local/sbin/postgresql_wal_backup_and_removal owner=root group=root mode=0755
|
||||||
|
tags: [ 'postgres', 'postgresql', 'sudo', 'pgpool' ]
|
||||||
|
|
||||||
|
- name: backuppc root script to syncronize backup and wal clean up
|
||||||
|
copy: src=backuppc_pg_wal.sh dest=/usr/local/sbin/backuppc_pg_wal.sh owner=root mode=0744
|
||||||
|
tags: [ 'postgres_backuppc', 'postgres', 'postgresql', 'pgpool' ]
|
||||||
|
|
||||||
# The script is started by the backup server after the file copy, crontab action must be deleted
|
# The script is started by the backup server after the file copy, crontab action must be deleted
|
||||||
#- name: Install a cron job to cleanup the wal log archives
|
#- name: Install a cron job to cleanup the wal log archives
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
ISMASTER=`psql -t -c "SELECT pg_is_in_recovery();"`
|
||||||
|
if [ $ISMASTER != 'f' ]
|
||||||
|
then
|
||||||
|
echo "Not on master, nothing to do."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
BASE_BACKUP_DIR={{ psql_base_backup_dir }}
|
BASE_BACKUP_DIR={{ psql_base_backup_dir }}
|
||||||
WAL_ARCHIVES_LOG_DIR={{ psql_wal_archiving_log_dir }}
|
WAL_ARCHIVES_LOG_DIR={{ psql_wal_archiving_log_dir }}
|
||||||
WAL_LATEST_BACKUP=
|
WAL_LATEST_BACKUP=
|
||||||
|
@ -15,3 +22,4 @@ pg_archivecleanup $WAL_ARCHIVES_LOG_DIR $WAL_LATEST_BACKUP
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue