#! /bin/bash set -e #PGDATA= if [ "$PGDATA" = "" ]; then echo set pgdata exit 1; fi # rm -rf $PGDATA ## danger!! rm -f /tmp/hoge initdb cat << EOF > $PGDATA/recovery.conf standby_mode='yes' primary_conninfo='host=/tmp port=9999' EOF cat << EOF >> $PGDATA/postgresql.conf restart_after_crash = off EOF pg_ctl start sleep 5 touch /tmp/hoge cat << EOF >> $PGDATA/postgresql.conf full_page_writes = off EOF pg_ctl promote sleep 10 pg_ctl stop -m i