ports/databases/pgpool-II-33/files/pgpool_copy_backup
Matthew Seaman 219d691b62 New port databases/pgpool-II-33
Repo copy from databases/pgpool-II. Changes from that port:

 - New port for pgpool-II33-3.3.3

 - Stagify

 - Add libtool, gmake, pgsql, perl5 to USES.  Drop .la files -- this is a
   new port, so there can't be any pre-existing consumers of the .la files
   to worry about.

 - Use options helpers

 - The configure used with this software is buggy and doesn't understand
   --without-foo.  Just omit any --with-foo or --without-foo to turn off
   'foo' support.

 - New options PAM MEMCACHED.  Enable PAM by default since it
   only depends on the base system.

 - Add RUN_DEPENDS on rsync and perl5 -- needed for the scripts
   pgpool_copy_backup and pgpool_remote_start respectively.

 - regenerate pkg-plist using 'make makeplist.'  Just use the auto-generated
   plist entries for %%PORTDOCS%% rather than the $PORTDOCS variable.

 - Simplify how docs and sql/contrib functions are installed

Redports:   	https://redports.org/buildarchive/20140629142900-20287/
PR:		189880
Submitted by:	michelle@sorbs.net
Reviewed by:	pi, matthew
2014-06-29 16:40:54 +00:00

40 lines
871 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# In postgresql.conf:
# archive_command = 'test -f /proj/pgsql/data/archive_log/%f || cp %p /proj/pgsql/data/archive_log/%f'
#
SRC=pgsql@$(hostname)
SRCDIR=$1
DEST=pgsql@$2
DESTDIR=$3
ARCLOG=$1/archive_log
logger="logger -t pgpool -p local0.info"
rsync="/usr/local/bin/rsync -av --delete --checksum"
excl="--exclude=pg_log --exclude=postmaster.pid"
psql="/usr/local/bin/psql"
/bin/sh <<EOF | ${logger} 2>&1
$psql -c "select pg_start_backup('pgpool-recovery')" template1
ssh $DEST "
/usr/local/bin/pg_ctl -D $DESTDIR -s -m fast stop;
rm -f $DESTDIR/backup_label"
echo "restore_command = 'scp $SRC:$ARCLOG/%f %p'" > $SRCDIR/recovery.conf
$rsync $SRCDIR/ $excl $DEST:/$DESTDIR/
ssh $DEST "
mkdir -p $DESTDIR/pg_xlog/archive_status;
mkdir -p $DESTDIR/pg_log"
rm -f $SRCDIR/recovery.conf
$psql -c 'select pg_stop_backup()' template1
EOF