#!/bin/bash PG_PRIMARY_PORT=5450 PG_STANDBY_PORT=5451 # Cleanup anything left over from previous runs. for d in pgprimary pgstandby; do if test -d $d; then pg_ctl stop -D $d; rm -rf $d fi rm -f $d.log done # Echo commands from this point onward and exit on failure. set -ex # Initialize and Create primary. # NB: Must enable archiving, but only for history files not WAL files. initdb -D pgprimary --encoding=UTF8 --no-locale # Create WAL archive directory mkdir -p pgprimary/arc cat >> pgprimary/postgresql.auto.conf <> pgstandby/postgresql.auto.conf <