FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit c58c79f1 authored by Dr Catherine Pitt's avatar Dr 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
No related branches found
Tags 0.9-ch70
No related merge requests found
...@@ -3,7 +3,7 @@ Priority: optional ...@@ -3,7 +3,7 @@ Priority: optional
Section: otherosfs Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk> Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all 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 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') Description: a backup system using ZFS (repository 'backup-scheduler')
Ported (well, mostly) from FreeBSD to a Sane OS. Ported (well, mostly) from FreeBSD to a Sane OS.
...@@ -42,6 +42,17 @@ if [ ! -f $CONFDIR/$SERVER/exclude ] ; then ...@@ -42,6 +42,17 @@ if [ ! -f $CONFDIR/$SERVER/exclude ] ; then
$SCP -q root@$SERVER:/var/adm/backup/package-files $CONFDIR/$SERVER/exclude $SCP -q root@$SERVER:/var/adm/backup/package-files $CONFDIR/$SERVER/exclude
fi 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 " $SSH root@$SERVER "
# Ensure that things are not readable where they ought not to be # Ensure that things are not readable where they ought not to be
umask 077 umask 077
...@@ -57,9 +68,6 @@ if [ -f /etc/mysql/my.cnf ] ; then ...@@ -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 [ -S \$SOCKET ] && which mysqldump >/dev/null 2>&1 && mysqldump --defaults-file=/etc/mysql/debian.cnf --all-databases >/var/adm/backup/mysql
fi 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 # Dump LDAP, if we can
which slapcat >/dev/null 2>&1 && slapcat >/var/adm/backup/ldap which slapcat >/dev/null 2>&1 && slapcat >/var/adm/backup/ldap
......
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