From 8af8276121d8ff36b8f2f9b85e7c17c0967d2f6b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 12 Oct 2012 14:53:18 +0200 Subject: o Allowing configurable -o options to be passed through the configuration. o Error message when pg_ctl could not be found. --- postgresql/bin/postgres-wrapper | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'postgresql/bin') diff --git a/postgresql/bin/postgres-wrapper b/postgresql/bin/postgres-wrapper index 26b69c3..86be981 100644 --- a/postgresql/bin/postgres-wrapper +++ b/postgresql/bin/postgres-wrapper @@ -1,7 +1,20 @@ -#!/bin/bash -e +#!/bin/bash -PATH=$PATH:/opt/local/bin CONF=etc/postgresql.conf +PG_CTL=`which pg_ctl 2>/dev/null` + +set -e + +pwd +. $APPSH_BASEDIR/.app/lib/app-conf + +PG_CTL_OPTIONS="`get_conf $APPSH_BASEDIR $APPSH_NAME $APPSH_INSTANCE postgresql.pg_ctl_options`" + +if [ -z "$PG_CTL" ] +then + echo "Could not find pg_ctl. Is your env.PATH correctly set?". + exit 1 +fi if [ -z "$DATA" ] then @@ -44,16 +57,16 @@ LOG=`cd $x; pwd`/`basename $LOG` case "$APPSH_METHOD" in start) echo "Starting postgresql" - exec pg_ctl start \ + exec $PG_CTL start \ -D "$DATA" \ - -o "-c config_file=$CONF" \ + -o "$PG_CTL_OPTIONS -c config_file=$CONF" \ -l $LOG & ;; stop) echo "Stopping postgresql" - exec pg_ctl stop \ + exec $PG_CTL stop \ -D "$DATA" \ - -o "-c config_file=$CONF" + -o "$PG_CTL_OPTIONS -c config_file=$CONF" ;; *) echo "Unknown method: $APPSH_METHOD" -- cgit v1.2.3