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. --- .gitignore | 1 + postgresql/Makefile | 3 +-- postgresql/bin/postgres-wrapper | 25 +++++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c1d64ce..4f7616f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ zip *.zip +*.swp diff --git a/postgresql/Makefile b/postgresql/Makefile index 7279f36..fa0bf5c 100644 --- a/postgresql/Makefile +++ b/postgresql/Makefile @@ -9,6 +9,5 @@ clean: postgresql-$(VERSION).zip: rm -rf zip mkdir -p zip/root - cp -r etc zip/root/etc/ - cp -r bin zip/root/bin/ + rsync -a --exclude '.*' bin etc zip/root (cd zip; zip -r ../$@ *) 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