summaryrefslogtreecommitdiff
path: root/dev-db
diff options
context:
space:
mode:
authorTiziano Müller <dev-zero@gentoo.org>2008-05-13 07:00:36 +0000
committerTiziano Müller <dev-zero@gentoo.org>2008-05-13 07:00:36 +0000
commitabf0e0ce1fd64e8a803022370a9311083d99a6ca (patch)
tree34a6992b980176efc2292a33a3322cf7aa78ceed /dev-db
parentStop passing CFLAGS for g++ and MAKEOPTS because scons is stupid wrt #220393. (diff)
downloadgentoo-2-abf0e0ce1fd64e8a803022370a9311083d99a6ca.tar.gz
gentoo-2-abf0e0ce1fd64e8a803022370a9311083d99a6ca.tar.bz2
gentoo-2-abf0e0ce1fd64e8a803022370a9311083d99a6ca.zip
Added workaround to init.d-files to correctly detect an already running server...
(Portage version: 2.1.5_rc7)
Diffstat (limited to 'dev-db')
-rw-r--r--dev-db/postgresql-server/ChangeLog9
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-7.320
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-7.425
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-8.018
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-8.118
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-8.218
-rw-r--r--dev-db/postgresql-server/files/postgresql.init-8.318
7 files changed, 113 insertions, 13 deletions
diff --git a/dev-db/postgresql-server/ChangeLog b/dev-db/postgresql-server/ChangeLog
index d4741eba2098..e6a2daf32914 100644
--- a/dev-db/postgresql-server/ChangeLog
+++ b/dev-db/postgresql-server/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-db/postgresql-server
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.2 2008/04/19 20:37:12 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.3 2008/05/13 07:00:35 dev-zero Exp $
+
+ 13 May 2008; Tiziano Müller <dev-zero@gentoo.org>
+ files/postgresql.init-7.3, files/postgresql.init-7.4,
+ files/postgresql.init-8.0, files/postgresql.init-8.1,
+ files/postgresql.init-8.2, files/postgresql.init-8.3:
+ Added workaround to init.d-files to correctly detect an already running
+ server...
19 Apr 2008; Tiziano Müller <dev-zero@gentoo.org>
files/postgresql.init-7.3, files/postgresql.init-7.4,
diff --git a/dev-db/postgresql-server/files/postgresql.init-7.3 b/dev-db/postgresql-server/files/postgresql.init-7.3
index 833387bc3169..2b158f518d94 100644
--- a/dev-db/postgresql-server/files/postgresql.init-7.3
+++ b/dev-db/postgresql-server/files/postgresql.init-7.3
@@ -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-7.3,v 1.2 2008/04/19 20:37:13 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-7.3,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-7.3/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'"
+ -c "env PGDATA=\"${PGDATA}\" PATH=\"/usr/lib/postgresql-7.3/bin:${PATH}\" /usr/lib/postgresql-7.3/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 $?
}
diff --git a/dev-db/postgresql-server/files/postgresql.init-7.4 b/dev-db/postgresql-server/files/postgresql.init-7.4
index b5ec7093069f..51e0b03deced 100644
--- a/dev-db/postgresql-server/files/postgresql.init-7.4
+++ b/dev-db/postgresql-server/files/postgresql.init-7.4
@@ -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-7.4,v 1.2 2008/04/19 20:37:13 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-7.4,v 1.3 2008/05/13 07:00:36 dev-zero Exp $
opts="${opts} reload"
@@ -25,19 +25,32 @@ checkconfig() {
start() {
checkconfig || return 1
- local retval
-
ebegin "Starting PostgreSQL"
if [ -f "$PGDATA/postmaster.pid" ] ; then
rm -f "$PGDATA/postmaster.pid"
fi
+ local retval
+
su -l ${PGUSER} \
- -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-7.4/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'"
+ -c "env PGDATA=\"${PGDATA}\" PATH=\"/usr/lib/postgresql-7.4/bin:${PATH}\" /usr/lib/postgresql-7.4/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'"
retval=$?
- echo $retval
- eend $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 $?
}
stop() {
diff --git a/dev-db/postgresql-server/files/postgresql.init-8.0 b/dev-db/postgresql-server/files/postgresql.init-8.0
index a6840b3ef314..da313583545c 100644
--- a/dev-db/postgresql-server/files/postgresql.init-8.0
+++ b/dev-db/postgresql-server/files/postgresql.init-8.0
@@ -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.0,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.0,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.0/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 $?
}
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 $?
}
diff --git a/dev-db/postgresql-server/files/postgresql.init-8.2 b/dev-db/postgresql-server/files/postgresql.init-8.2
index 8dd4c4f59893..fea496e5e412 100644
--- a/dev-db/postgresql-server/files/postgresql.init-8.2
+++ b/dev-db/postgresql-server/files/postgresql.init-8.2
@@ -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.2,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.2,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.2/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 $?
}
diff --git a/dev-db/postgresql-server/files/postgresql.init-8.3 b/dev-db/postgresql-server/files/postgresql.init-8.3
index e284ddc58a6e..d68911b40783 100644
--- a/dev-db/postgresql-server/files/postgresql.init-8.3
+++ b/dev-db/postgresql-server/files/postgresql.init-8.3
@@ -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.3,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.3,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.3/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 $?
}