summaryrefslogtreecommitdiff
path: root/pgruntime/tool_template.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pgruntime/tool_template.sh')
-rw-r--r--pgruntime/tool_template.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/pgruntime/tool_template.sh b/pgruntime/tool_template.sh
new file mode 100644
index 0000000..d0ddea1
--- /dev/null
+++ b/pgruntime/tool_template.sh
@@ -0,0 +1,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 "$@"