diff options
Diffstat (limited to 'pgruntime/tool_template.sh')
| -rw-r--r-- | pgruntime/tool_template.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pgruntime/tool_template.sh b/pgruntime/tool_template.sh new file mode 100644 index 0000000..7e3827f --- /dev/null +++ b/pgruntime/tool_template.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")" + +stop_postgres() { + EXIT_CODE=$? + pg_ctl stop --wait --silent -D datadir + exit "${EXIT_CODE}" +} +trap stop_postgres EXIT INT TERM + +rm -f -- run/postgresql.log +pg_ctl start --wait --silent -D datadir -l run/postgresql.log +$COMMAND -U postgres -h 127.0.0.1 -p 54320 "$@" |
