pgstatus() {
PG_STATUS="unknown"
PG_PID="unknown"
- output=`TMPDIR=/tmp su - postgres -c "/usr/bin/pg_ctl -D $1 status"`
+ output=`TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $1 status"`
status=`echo $?`
if [ $status -eq 1 ]; then
pgstart() {
msg_starting "PostgreSQL $1"
busy
- TMPDIR=/tmp su - postgres -c "/usr/bin/pg_ctl -w -D $1 start 2>&1 >/dev/null"
+ TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -w -D $1 start 2>&1 >/dev/null"
sleep 1
pgstatus "$1"
busy
# is postgresql really alive?
if ps ax | grep -v grep | grep -q "$PG_PID"; then
- TMPDIR=/tmp su - postgres -c "/usr/bin/pg_ctl -w -D $pgdir stop -m fast 2>&1 >/dev/null"
+ TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -w -D $pgdir stop -m fast 2>&1 >/dev/null"
pgstatus "$pgdir"
if [ "$PG_STATUS" != "not running" ]; then
fail
;;
status)
for pgdir in $DB_CLUSTERS; do
- TMPDIR=/tmp su - postgres -c "/usr/bin/pg_ctl -D $pgdir status"
+ TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir status"
done
;;
restart)
busy
# is postgresql really alive?
if ps ax | grep -v grep | grep -q "$PG_PID"; then
- TMPDIR=/tmp su - postgres -c "/usr/bin/pg_ctl -D $pgdir restart 2>&1 >/dev/null"
+ TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir restart 2>&1 >/dev/null"
pgstatus "$pgdir"
if [ "$PG_STATUS" = "running" ]; then
ok
mkdir -p $pgdir
chmod 700 $pgdir
chown postgres:postgres $pgdir
- TMPDIR=/tmp su - postgres -s /bin/sh -c "initdb -E UNICODE -D $pgdir"
+ TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE -D $pgdir"
fi
done
echo $(nls "REMEMBER to setup password for user \"postgres\"")'!'