summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db/postgresql-server/files/postgresql.init-8.1')
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-8.118
1 files changed, 17 insertions, 1 deletions
diff --git a/dev-db/postgresql-server/files/postgresql.init-8.1 b/dev-db/postgresql-server/files/postgresql.init-8.1
index b277eee1742f..188746da9f9c 100644
--- a/dev-db/postgresql-server/files/postgresql.init-8.1
+++ b/dev-db/postgresql-server/files/postgresql.init-8.1
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.1,v 1.2 2008/04/19 20:37:13 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.1,v 1.3 2008/05/13 07:00:36 dev-zero Exp $
opts="${opts} reload"
@@ -31,9 +31,25 @@ start() {
rm -f "$PGDATA/postmaster.pid"
fi
+ local retval
+
su -l ${PGUSER} \
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.1/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'"
+ retval=$?
+ [ $retval -ne 0 ] && eend $retval && return $retval
+
+ # The following is to catch the case of an already running server
+ # in which pg_ctl doesn't know to which server it connected to and false reports the server as 'up'
+ sleep 2
+ if [ ! -f "$PGDATA/postmaster.pid" ] ; then
+ eerror "The pid-file doesn't exist but pg_ctl reported a running server."
+ eerror "Please check whether there is another server running on the same port or read the log-file."
+ eend 1
+ return 1
+ fi
+ local pid=$(grep "^[0-9]\+" "$PGDATA/postmaster.pid")
+ ps -p "${pid}" &> /dev/null
eend $?
}