summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-12 14:53:18 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-12 14:53:18 +0200
commit8af8276121d8ff36b8f2f9b85e7c17c0967d2f6b (patch)
treec46e534c83ccf35472243ed63e6c2365e4a64c49
parent7b91c886d9db1f81818e3b73b37fcb5d85734f59 (diff)
downloadapp.sh-misc-master.tar.gz
app.sh-misc-master.tar.bz2
app.sh-misc-master.tar.xz
app.sh-misc-master.zip
o Allowing configurable -o options to be passed through the configuration.HEADmaster
o Error message when pg_ctl could not be found.
-rw-r--r--.gitignore1
-rw-r--r--postgresql/Makefile3
-rw-r--r--postgresql/bin/postgres-wrapper25
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"