]> TLD Linux GIT Repositories - packages/postgresql.git/blobdiff - postgresql.init
- moved data clusters to /var/lib/postgresql, misc fixes
[packages/postgresql.git] / postgresql.init
index ac82745e5bf709c5390b2ef73b44e09b443f9a52..394692c0f613a51b3eed459a47acbdcdfbefc58c 100644 (file)
@@ -21,10 +21,10 @@ cd /
 PG_INIT_LOCALE=C
 
 # Get service config
-if [ -f /etc/sysconfig/postgresql10 ]; then
-       . /etc/sysconfig/postgresql10
+if [ -f /etc/sysconfig/postgresql-@pgsqlversion@ ]; then
+       . /etc/sysconfig/postgresql-@pgsqlversion@
 else
-       nls "Error: %s not found" /etc/sysconfig/postgresql10
+       nls "Error: %s not found" /etc/sysconfig/postgresql-@pgsqlversion@
        nls " PostgreSQL can't be run."
        exit 1
 fi
@@ -106,11 +106,11 @@ pgsubsys() {
        for pgdir in $PG_DB_CLUSTERS; do
                pgstatus "$pgdir"
                if [ "$PG_STATUS" = "running" ]; then
-                       touch /var/lock/subsys/postgresql10
+                       touch /var/lock/subsys/postgresql-@pgsqlversion@
                        return
                fi
        done
-       rm -f /var/lock/subsys/postgresql10
+       rm -f /var/lock/subsys/postgresql-@pgsqlversion@
 }
 
 #
@@ -123,7 +123,7 @@ start() {
                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;
@@ -148,8 +148,8 @@ stop() {
                        msg_stopping "PostgreSQL $pgdir"
                        busy
                        # is postgresql really alive?
-                       if ps -p "$PG_PID" >/dev/null; then
-                               TMPDIR=/tmp su postgres -c "@pgsqlbindir@/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
@@ -214,8 +214,8 @@ case "$action" in
                        msg_reloading "PostgreSQL $pgdir"
                        busy
                        # is postgresql really alive?
-                       if ps -p "$PG_PID" >/dev/null; then
-                               TMPDIR=/tmp su postgres -c "@pgsqlbindir@/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