2026-03-12 21:01:38

This commit is contained in:
2026-03-12 22:01:38 +01:00
parent 3bd1db26cc
commit 26296b6d6a
336 changed files with 27507 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Online backup script using pg_basebackup
##########################################
BACKUP_DIR=/backup/postgresql/pgdata
BACKUP_COMPRESSED_DIR=/backup/postgresql/daily
if [ -z "${BACKUP_DIR}" ]
then
echo "\${BACKUP_DIR} variable is empty"
exit 1
else
rm -rf ${BACKUP_DIR}/*
fi
if [ -z "${BACKUP_COMPRESSED_DIR}" ]
then
echo "\${BACKUP_COMPRESSED_DIR} variable is empty"
exit 1
fi
pg_basebackup -h localhost -P -D ${BACKUP_DIR}
pg_verifybackup ${BACKUP_DIR}
if [ "$?" != "0" ]
then
echo "Verify backup failed"
exit 1
fi
NOW=$(date '+%Y-%m-%d__%H_%M_%S')
cd ${BACKUP_DIR}
tar -cvf - * | pigz > ${BACKUP_COMPRESSED_DIR}/${NOW}.tar.gz
##########################################
# https://public.dalibo.com/exports/formation/manuels/modules/i2/i2.handout.html