opnsense-ports/databases/pgpool-II/files/pgpool_switch_xlog
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

20 lines
407 B
Bash

#!/bin/sh
#
# $FreeBSD$
logger="logger -t pgpool -p local0.info"
psql=/usr/local/bin/psql
/bin/sh <<EOF | ${logger} 2>&1
$psql -t -c 'SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn' template1 |
while read i
do
if [ "$i" != "" ];then
$psql -c "SELECT setval(oid, nextval(oid)) FROM pg_class WHERE relkind = 'S'" $i
fi
done
$psql -c 'select pg_switch_xlog()' template1
EOF