]> git.pld-linux.org Git - packages/postgresql.git/blobdiff - postgresql.init
- merged from DEVEL
[packages/postgresql.git] / postgresql.init
index b5d30c871718af477a567bbb66151c4f09b4cc20..f0a484efb936c3a41f801a506aeb65f2c70ed3f7 100644 (file)
@@ -69,13 +69,15 @@ fi
 pgstatus() {
        PG_STATUS="unknown"
        PG_PID="unknown"
-       status=`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 echo "$status" | grep -q 'pg_ctl: postmaster or postgres not running'; then
+       if [ $status -eq 1 ]; then
                PG_STATUS="not running"
-       elif echo "$status" | grep -q 'pg_ctl: postmaster is running'; then
+       elif [ $status -eq 0 ]; then
                PG_STATUS="running"
-               PG_PID=`echo "$status" | sed 's/^pg_ctl:.*PID: \([0-9]\+\).*/\1/' | head -1`
+        # or maybe grab it from postmaster.pid file?
+               PG_PID=`echo "$output" | sed 's/^pg_ctl:.*PID: \([0-9]\+\).*/\1/' | head -1`
        fi
 }
 
@@ -91,6 +93,7 @@ pgstart() {
        TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -w -D $1 start 2>&1 >/dev/null"
        sleep 1
        pgstatus "$1"
+
        if [ "$PG_STATUS" != "unknown" -a "$PG_PID" != "unknown" ]; then
                ok
        else
This page took 0.16602 seconds and 4 git commands to generate.