X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=pgtest.sh;h=d911b5c9dbd47fb3f4e6a8e8966d63dab08697ba;hb=5ff45cf49816b4839224edf89c59a5c77ceba4b5;hp=3c746295d8e1901973847afd1a8bb1052a5b8503;hpb=c7e2439eb830c872d3b088869218928d645a32e7;p=postrr.git diff --git a/pgtest.sh b/pgtest.sh index 3c74629..d911b5c 100755 --- a/pgtest.sh +++ b/pgtest.sh @@ -26,13 +26,15 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -PG_CONFIG=`which pg_config` +if test -z "$PG_CONFIG"; then + PG_CONFIG=`which pg_config` +fi if test -z "$PG_CONFIG"; then echo "pg_config not found!" >&2 exit 1 fi -BIN_DIR=`pg_config --bindir` +BIN_DIR=`$PG_CONFIG --bindir` if test -z "$TARGET"; then TARGET=`pwd`/target fi @@ -91,6 +93,17 @@ case "$1" in $BIN_DIR/postgres -D $TARGET/var/lib/postgresql/main "$@" fi ;; + restart) + $0 stop && $0 start -B + ;; + dump) + shift + $BIN_DIR/pg_dump -h $TARGET/var/run/postgresql/ -p 2345 "$@" + ;; + restore) + shift + $BIN_DIR/pg_restore -h $TARGET/var/run/postgresql/ -p 2345 "$@" + ;; *) echo "Usage: $0 setup|client|stop|start" >&2 echo "" @@ -103,6 +116,8 @@ case "$1" in echo " Start the PostgreSQL server." echo " - stop" echo " Stop the PostgreSQL server." + echo " - restart" + echo " Restart a background PostgreSQL server process." echo "" echo "Environment variables:" echo " - TARGET"