From 230d094cde2778ba3168f33be7fd02053fec6187 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 30 Apr 2012 16:29:31 +0200 Subject: [PATCH] pgtest.sh: Pass additional arguments to client and start. Also, check for any additional arguments in all other commands. --- pgtest.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pgtest.sh b/pgtest.sh index b88bf6c..692de5e 100755 --- a/pgtest.sh +++ b/pgtest.sh @@ -44,6 +44,11 @@ set -e case "$1" in setup) + if test $# -ne 1; then + echo "Too many arguments!" >&2 + echo "Usage: $0 setup" >&2 + exit 1 + fi mkdir -p $TARGET/var/lib/postgresql/main mkdir -p $TARGET/var/run/postgresql mkdir -p $TARGET/var/log/postgresql/main @@ -66,16 +71,24 @@ case "$1" in export LD_PRELOAD="$LD_PRELOAD:$libreadline" fi fi - $BIN_DIR/psql -h $TARGET/var/run/postgresql/ -p 5435 + shift + $BIN_DIR/psql -h $TARGET/var/run/postgresql/ -p 5435 "$@" ;; stop) + if test $# -ne 1; then + echo "Too many arguments!" >&2 + echo "Usage: $0 setup" >&2 + exit 1 + fi $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main stop ;; start) - if test "$2" = "-B"; then - $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main -l logfile -w start + shift + if test "$1" = "-B"; then + shift + $BIN_DIR/pg_ctl -D $TARGET/var/lib/postgresql/main -l logfile -w start "$@" else - $BIN_DIR/postgres -D $TARGET/var/lib/postgresql/main + $BIN_DIR/postgres -D $TARGET/var/lib/postgresql/main "$@" fi ;; *) -- 2.30.2