FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 6f4dfa12 authored by Dr Catherine Pitt's avatar Dr Catherine Pitt
Browse files

new-backup-rsnapshot better support for postgres backups

The new-backup-rsnapshot script understands a 'postgres' argument, but
this set up a postgres backup in an old style that we no longer use.
This change updates it to do some of the work of setting up a new style
postgres backup and tell the user what else they might need to edit to
make it go; it varies quite a lot depending on server.
parent 3c040a2c
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ Priority: optional
Section: otherosfs
Maintainer: Frank Lee <rl201@cam.ac.uk>
Architecture: all
Version: 0.9-ch60
Version: 0.9-ch61
Depends: zfs-dkms, postgresql-9.5 | postgresql-9.4 , liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv, libwww-curl-perl
Description: a backup system using ZFS
Ported (well, mostly) from FreeBSD to a Sane OS.
......@@ -67,13 +67,21 @@ function backuptask() {
FQDN=$1
TARGET=$2
DIR=$3
SOFT=$4
HARD=$5
if [ -z "$SOFT" ]; then
SOFT=14400
fi
if [ -z "$HARD" ]; then
HARD=86400
fi
BTID=`dosql "
select backup_task_id from backup_task natural join host natural join zfs_rsync_detail where hostname='$FQDN' and directory_source='$DIR' and backup_type_id=3;"`
SN=`echo $FQDN | sed s/\\\\..*//`
if [ -z $BTID ] ; then
BTID=`dosql "
insert into backup_task(host_id,backup_task_name,timeout_soft,timeout_hard,zfs_target,backup_type_id) values
($HOSTID,'Rsync $DIR on $SN',14400,86400,'$TARGET',3);
($HOSTID,'Rsync $DIR on $SN',$SOFT,$HARD,'$TARGET',3);
insert into zfs_rsync_detail (backup_task_id,directory_source) values
((select backup_task_id from backup_task where backup_task_name='Rsync $DIR on $SN' and host_id=$HOSTID),'$DIR');
select backup_task_id from backup_task natural join host natural join zfs_rsync_detail where hostname='$FQDN' and directory_source='$DIR' and backup_type_id=3;"`
......@@ -132,7 +140,10 @@ getsshkey $FQDN
while ! [ -z $1 ] ; do
case $1 in
postgres)
backupdir $FQDN $TGT/postgresql /var/lib/postgresql
backupdir $FQDN $TGT/pgdumps /var/empty 43200 60480
echo "Now set up /etc/chem-zfs-backup-server/zfs-rsync.d/${FQDN}_.var.empty to"
echo "run your postgres backup task as the PRE command, and you probably also want"
echo "to change the prepare script in /etc/chem-zfs-backup-server/zfs-rsync.d/${FQDN}_. too."
;;
mysql)
backupdir $FQDN $TGT/mysql-files /var/lib/mysql-files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment