aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2001-04-21 11:23:58 +0000
committerPeter Eisentraut <peter_e@gmx.net>2001-04-21 11:23:58 +0000
commit9ae6819038afca93a6ea5790cf176c91c1c0de01 (patch)
treebb0833ef69d6f15738a1d55d927ced77beb22523 /src
parente6767a32053963a968f419256e3629ace5e8df2f (diff)
downloadpostgresql-9ae6819038afca93a6ea5790cf176c91c1c0de01.tar.gz
postgresql-9ae6819038afca93a6ea5790cf176c91c1c0de01.zip
Make sure that the postmaster options (from postmaster.opts[.default] or
-o option) are properly dequoted. Also, always pass an explicit -D option to postmaster, don't rely on it being set in postmaster.opts.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bin/pg_ctl/pg_ctl.sh32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.sh b/src/bin/pg_ctl/pg_ctl.sh
index dc3a6282521..abc06b8d3f3 100755
--- a/src/bin/pg_ctl/pg_ctl.sh
+++ b/src/bin/pg_ctl/pg_ctl.sh
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.19 2001/03/18 20:27:11 tgl Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.20 2001/04/21 11:23:58 petere Exp $
#
#-------------------------------------------------------------------------
@@ -299,37 +299,33 @@ if [ $op = "start" -o $op = "restart" ];then
oldpid=`sed -n 1p $PIDFILE`
fi
- unset logopt
- if [ -n "$logfile" ]; then
- logopt='</dev/null >>$logfile 2>&1'
- else
- # when starting without log file, redirect stderr to stdout, so
- # pg_ctl can be invoked with >$logfile and still have pg_ctl's
- # stderr on the terminal.
- logopt='</dev/null 2>&1'
- fi
-
# no -o given
if [ -z "$POSTOPTS" ];then
if [ $op = "start" ];then
# if we are in start mode, then look for postmaster.opts.default
if [ -f $DEFPOSTOPTS ]; then
- POSTOPTS=`cat $DEFPOSTOPTS`
+ eval set X "`cat $DEFPOSTOPTS`"; shift
fi
- POSTOPTS="-D $PGDATA $POSTOPTS"
else
# if we are in restart mode, then look for postmaster.opts
- set X `cat $POSTOPTSFILE`
- shift
+ eval set X "`cat $POSTOPTSFILE`"; shift
po_path=$1
shift
- POSTOPTS=$@
fi
else # -o given
- POSTOPTS="-D $PGDATA $POSTOPTS"
+ eval set X "$POSTOPTS"; shift
fi
- eval '$po_path' '$POSTOPTS' $logopt '&'
+ set X -D "$PGDATA" ${1+"$@"}; shift
+
+ if [ -n "$logfile" ]; then
+ "$po_path" "$@" </dev/null >>$logfile 2>&1 &
+ else
+ # when starting without log file, redirect stderr to stdout, so
+ # pg_ctl can be invoked with >$logfile and still have pg_ctl's
+ # stderr on the terminal.
+ "$po_path" "$@" </dev/null 2>&1 &
+ fi
# if had an old lockfile, check to see if we were able to start
if [ -n "$oldpid" ];then