FAQ | This is a LIVE service | Changelog

Commit 83e54e26 authored by Catherine Pitt's avatar Catherine Pitt
Browse files

Add prepare-redhat script

prepare-nondebian does not work on RedHat machines running MySQL as the
paths are different, so providing a fixed version. prepare-nondebian has
historically been used more widely than just RedHat, hence the decision
to provide a RedHat-specific version and not just edit it.
parent ca4eaf3b
......@@ -3,6 +3,6 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch77
Version: 0.9-ch78
Depends: zfs-dkms, postgresql-13 | 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')
#set -x
# A script which runs, largely on the remote machine, to prepare for backup
# Jobs to do:
# * Exclude files which are only found in packages
# * List all packages which are installed
# * (optionally) dump MySQL into a file
# * (optionally) dump PostgreSQL into a file
if [ -z "$SERVER" ] ; then
echo $0 Server
exit 1
# Create some necessary files
mkdir -p /etc/chem-zfs-backup-server/zfs-rsync.d/$SERVER
touch /etc/chem-zfs-backup-server/zfs-rsync.d/$SERVER/exclude
ssh root@$SERVER "
umask 077
mkdir -p /var/adm/backup
touch /var/adm/backup/packages
touch /var/adm/backup/package-files
mkdir -p /etc/rsnapshot/$SERVER
scp -q root@$SERVER:/var/adm/backup/package-files /etc/rsnapshot/$SERVER/exclude
ssh root@$SERVER "
# Ensure that things are not readable where they ought not to be
umask 077
# Dump MySQL, if the root user has access
if [ -f /etc/my.cnf ] ; then
SOCKET=`awk ' BEGIN {FLAG=0} (\$0 ~ /^\[/) {FLAG=0} (\$0 ~ /^\[mysqld\]/) {FLAG=1} (\$1=="socket" && FLAG==1) { print \$3 ; } ' </etc/my.cnf`
[ -S \$SOCKET ] && which mysqldump >/dev/null 2>&1 && mysqldump --all-databases >/var/adm/backup/mysql
# 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 >/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
# Ignore exit status of this command
echo Prepared $SERVER `date`
) >/var/log/chem-zfs-backup-server/${SERVER}-prepare 2>&1
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