FAQ | This is a LIVE service | Changelog

Commit c58c79f1 authored by Catherine Pitt's avatar Catherine Pitt
Browse files

Default prepare script supports Postgres 12 and up

The default prepare script now uses appropriate options if it detects Postgres
12 or higher. The error handling still needs work though.

Update prepare script for newer Postgres
parent b37983ee
......@@ -3,7 +3,7 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch69
Version: 0.9-ch70
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 (repository 'backup-scheduler')
Ported (well, mostly) from FreeBSD to a Sane OS.
......@@ -42,6 +42,17 @@ if [ ! -f $CONFDIR/$SERVER/exclude ] ; then
$SCP -q root@$SERVER:/var/adm/backup/package-files $CONFDIR/$SERVER/exclude
fi
if $SSH root@$SERVER id postgres >/dev/null 2>&1 ; then
PGVER=$($SSH root@$SERVER pg_lsclusters| awk -F '[. ]+' '/online/ { print $1 }')
if [[ -n "$PGVER" ]]; then
if (( "$PGVER" >= 12 )) ; then
$SSH root@$SERVER "umask 077; su -c 'pg_dumpall --clean' postgres |gzip -9 >/var/adm/backup/postgres" || echo Postgres failed on $SERVER
else
$SSH root@$SERVER "umask 077; su -c 'pg_dumpall --oids --clean' postgres |gzip -9 >/var/adm/backup/postgres" || echo Postgres failed on $SERVER
fi
fi
fi
$SSH root@$SERVER "
# Ensure that things are not readable where they ought not to be
umask 077
......@@ -57,9 +68,6 @@ if [ -f /etc/mysql/my.cnf ] ; then
[ -S \$SOCKET ] && which mysqldump >/dev/null 2>&1 && mysqldump --defaults-file=/etc/mysql/debian.cnf --all-databases >/var/adm/backup/mysql
fi
# Dump PostgresSQL, if the postgres user has access
id postgres >/dev/null 2>&1 && [ -d /var/run/postgresql/ ] && [ -x /usr/bin/pg_dumpall ] && ( su -c 'pg_dumpall --oids --clean' postgres |gzip -9 >/var/adm/backup/postgres || echo Postgres failed on $SERVER )
# Dump LDAP, if we can
which slapcat >/dev/null 2>&1 && slapcat >/var/adm/backup/ldap
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment