Pass -D option to pg_ctl because export PGDATA won't be preserved across

'su -l'.

Reported by <VASQUEZ_JASON@LILLY.COM>.
This commit is contained in:
Peter Eisentraut 2001-04-19 19:17:44 +00:00
parent 47324d7689
commit 031e1afa23
2 changed files with 10 additions and 14 deletions

View File

@ -6,7 +6,7 @@
# Created through merger of the Linux start script by Ryan Kirkpatrick # Created through merger of the Linux start script by Ryan Kirkpatrick
# and the script in the FreeBSD ports collection. # and the script in the FreeBSD ports collection.
# $Header: /cvsroot/pgsql/contrib/start-scripts/freebsd,v 1.1 2001/02/10 00:13:23 petere Exp $ # $Header: /cvsroot/pgsql/contrib/start-scripts/freebsd,v 1.2 2001/04/19 19:17:44 petere Exp $
## EDIT FROM HERE ## EDIT FROM HERE
@ -24,8 +24,6 @@ PGLOG="$PGDATA/serverlog"
## STOP EDITING HERE ## STOP EDITING HERE
export PGDATA
# The path that is to be used for the script # The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@ -36,17 +34,17 @@ test -x "$DAEMON" || exit 0
case $1 in case $1 in
start) start)
su -l $PGUSER -c "$DAEMON start -s -l $PGLOG" su -l $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG"
echo -n ' postgresql' echo -n ' postgresql'
;; ;;
stop) stop)
su -l $PGUSER -c "$DAEMON stop -s -m fast" su -l $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
;; ;;
restart) restart)
su -l $PGUSER -c "$DAEMON restart -s -m fast" su -l $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
;; ;;
status) status)
su -l $PGUSER -c "$DAEMON status" su -l $PGUSER -c "$DAEMON status -D '$PGDATA'"
;; ;;
*) *)
# Print help # Print help

View File

@ -20,7 +20,7 @@
# Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net> # Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net>
# $Header: /cvsroot/pgsql/contrib/start-scripts/linux,v 1.1 2001/02/08 19:53:33 petere Exp $ # $Header: /cvsroot/pgsql/contrib/start-scripts/linux,v 1.2 2001/04/19 19:17:44 petere Exp $
## EDIT FROM HERE ## EDIT FROM HERE
@ -38,8 +38,6 @@ PGLOG="$PGDATA/serverlog"
## STOP EDITING HERE ## STOP EDITING HERE
export PGDATA
# Check for echo -n vs echo \c # Check for echo -n vs echo \c
if echo '\c' | grep -s c >/dev/null 2>&1 ; then if echo '\c' | grep -s c >/dev/null 2>&1 ; then
ECHO_N="echo -n" ECHO_N="echo -n"
@ -64,21 +62,21 @@ test -f $DAEMON || exit 0
case $1 in case $1 in
start) start)
$ECHO_N "Starting PostgreSQL: "$ECHO_C $ECHO_N "Starting PostgreSQL: "$ECHO_C
su - $PGUSER -c "$DAEMON start -s -l $PGLOG" su - $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG"
echo "ok" echo "ok"
;; ;;
stop) stop)
echo -n "Stopping PostgreSQL: " echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$DAEMON stop -s -m fast" su - $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
echo "ok" echo "ok"
;; ;;
restart) restart)
echo -n "Restarting PostgreSQL: " echo -n "Restarting PostgreSQL: "
su - $PGUSER -c "$DAEMON restart -s -m fast" su - $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
echo "ok" echo "ok"
;; ;;
status) status)
su - $PGUSER -c "$DAEMON status" su - $PGUSER -c "$DAEMON status -D '$PGDATA'"
;; ;;
*) *)
# Print help # Print help