aboutsummaryrefslogtreecommitdiff
path: root/pgruntime/tool_template.sh
blob: d0ddea1b3481a237ff43ee636aba7ac361ea21b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash
set -euo pipefail

stop_postgres() {
	EXIT_CODE=$?
	pg_ctl stop --wait --silent -D .testdb/datadir
	exit "${EXIT_CODE}"
}
trap stop_postgres EXIT INT TERM

rm -f -- .testdb/run/postgresql.log
pg_ctl start --wait --silent -D .testdb/datadir -l .testdb/run/postgresql.log
$COMMAND -U postgres -h 127.0.0.1 -p 54320 "$@"