sync repo.

This commit is contained in:
root
2022-10-31 09:37:42 -07:00
parent d10d71fbef
commit 7d5213f213
17 changed files with 49 additions and 934 deletions
+9 -23
View File
@@ -12,6 +12,11 @@ function prepare_backup_disk {
fi
##
# Create Mount point if it is not already exists;
if [ ! -d "${CONFLUENCE_HOME_SNAP}" ]; then
mkdir -p ${CONFLUENCE_HOME_SNAP}
fi
# Confirm there are no existing snapshots, exit if present
if [ $(lvs | grep -ic snap) -gt 0 ]; then
@@ -32,42 +37,23 @@ function backup_disk {
vg=$(lvs | grep $snapshot_name | cut -d" " -f4)
snap_volume=/dev/$vg/$snapshot_name
mount -onouuid,ro $snap_volume /data1/snapshot
mount -onouuid,ro $snap_volume ${CONFLUENCE_HOME_SNAP}
# Create new variable to define source of backup as snapshot
CONFLUENCE_HOME_SNAP=/data1/snapshot/CONFLUENCE-home/
# rsync home from snapshot
# perform_rsync_home_directory
# perform_rsync_data_stores
perform_compress_data
perform_rsync_compress_data
# unmount and remove lvm snapshot
umount /data1/snapshot
umount ${CONFLUENCE_HOME_SNAP}
lvremove -f $snap_volume
}
## Functions copied from the rsync script since we are essentially using rsync but utilizing an lvm snap as the source
## instead. Changed CONFLUENCE_HOME to CONFLUENCE_HOME_SNAP where appropriate and tagged each change in case we ever
## need to redo. We still want restores to work the same(from the archive file) so no changes there only on the
## backup rsyncs - JM
function perform_compress_data {
# Globals
backupDir="/backup/confluence"
pgdump="pg_dump"
# Backup target directories
backupDirDaily="$backupDir/$day_new_format"
day_new_format=$(date +%Y-%m-%d)
tar -czPf $backupDirDaily/$day_new_format.tgz /data1/snapshot
tar -czPf $CONFLUENCE_TMP/$day_new_format.tgz $CONFLUENCE_HOME_SNAP
}
function perform_rsync_compress_data {
rsync -avh --progress $backupDirDaily/$day_new_format.tgz /backup/confluence
rsync --remove-source-files -h $CONFLUENCE_TMP/$day_new_format.tgz $CONFLUENCE_BACKUP_HOME/
}
function prepare_restore_disk {