PG_INIT_LOCALE=C
# Get service config
-if [ -f /etc/sysconfig/postgresql ]; then
- . /etc/sysconfig/postgresql
+if [ -f /etc/sysconfig/postgresql-@pgsqlversion@ ]; then
+ . /etc/sysconfig/postgresql-@pgsqlversion@
else
- nls "Error: %s not found" /etc/sysconfig/postgresql
+ nls "Error: %s not found" /etc/sysconfig/postgresql-@pgsqlversion@
nls " PostgreSQL can't be run."
exit 1
fi
pgstatus() {
PG_STATUS="unknown"
PG_PID="unknown"
- output=$(LC_ALL=C TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $1 status")
+ output=$(LC_ALL=C TMPDIR=/tmp su postgres -c "@pgsqlbindir@/pg_ctl -D $1 status")
status=$?
if [ $status -eq 3 ]; then
pgstart() {
is_no "$RC_LOGGING" && fork=--fork
msg_starting "PostgreSQL $1"
- daemon $fork --user postgres /usr/bin/pg_ctl -s -w -D $1 start
+ daemon $fork --user postgres @pgsqlbindir@/pg_ctl -s -w -D $1 start
}
#
for pgdir in $PG_DB_CLUSTERS; do
pgstatus "$pgdir"
if [ "$PG_STATUS" = "running" ]; then
- touch /var/lock/subsys/postgresql
+ touch /var/lock/subsys/postgresql-@pgsqlversion@
return
fi
done
- rm -f /var/lock/subsys/postgresql
+ rm -f /var/lock/subsys/postgresql-@pgsqlversion@
}
#
if [ "$PG_STATUS" = "running" ]; then
# pg_ctl status can misinform us about postgresql status
# so let's check if postmaster is really alive
- if ps -p "$PG_PID" >/dev/null; then
+ if ps -p "$PG_PID" 1>/dev/null 2>&1; then
msg_already_running "PostgreSQL $pgdir"
else
# pg_ctl has misinformed us about postgresql status;
msg_stopping "PostgreSQL $pgdir"
busy
# is postgresql really alive?
- if ps -p "$PG_PID" >/dev/null; then
- TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -w -D $pgdir stop -m fast 2>&1 >/dev/null"
+ if ps -p "$PG_PID" 1>/dev/null 2>&1; then
+ TMPDIR=/tmp su postgres -c "@pgsqlbindir@/pg_ctl -w -D $pgdir stop -m fast 1>/dev/null 2>&1"
pgstatus "$pgdir"
if [ "$PG_STATUS" != "not running" ]; then
fail
msg_reloading "PostgreSQL $pgdir"
busy
# is postgresql really alive?
- if ps -p "$PG_PID" >/dev/null; then
- TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir $pgctlact 2>&1 >/dev/null"
+ if ps -p "$PG_PID" 1>/dev/null 2>&1; then
+ TMPDIR=/tmp su postgres -c "@pgsqlbindir@/pg_ctl -D $pgdir $pgctlact 1>/dev/null 2>&1"
pgstatus "$pgdir"
if [ "$PG_STATUS" = "running" ]; then
ok
mkdir -p $pgdir
chmod 700 $pgdir
chown postgres:postgres $pgdir
- LC_ALL=$PG_INIT_LOCALE TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE --data-checksums -D $pgdir"
+ LC_ALL=$PG_INIT_LOCALE TMPDIR=/tmp su postgres -s /bin/sh -c "@pgsqlbindir@/initdb -E UNICODE --data-checksums -D $pgdir"
fi
done
echo $(nls "REMEMBER to setup password for user \"postgres\"")'!'