public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Aaron Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
Date: Sun, 20 Mar 2011 01:36:29 +0000 (UTC)	[thread overview]
Message-ID: <a43d11fff0d6eaded238d7c3c58689df3f73cee2.titanofold@gentoo> (raw)

commit:     a43d11fff0d6eaded238d7c3c58689df3f73cee2
Author:     Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 01:34:34 2011 +0000
Commit:     Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 01:34:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=a43d11ff

Initscript and related conf for 8.3+.

---
 postgresql.confd |   18 ++++++++++++------
 postgresql.init  |   37 ++++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/postgresql.confd b/postgresql.confd
index e306c96..d9dc7fd 100644
--- a/postgresql.confd
+++ b/postgresql.confd
@@ -6,21 +6,27 @@ PGPORT="5432"
 WAIT_FOR_START="-w"
 WAIT_FOR_STOP="-w"
 
+# How long to wait for server to start in seconds
+START_TIMEOUT=60
+
 # Ignore new connections and wait for clients to disconnect from server before
 # shutting down.
-# Set NICE_QUIT to "NO" to disable.
+# Set NICE_QUIT to "NO" to disable. NICE_TIMEOUT in seconds.
 NICE_QUIT="YES"
+NICE_TIMEOUT=60
 
 # Forecfully disconnect clients from server and shut down. This is performed
 # after NICE_QUIT. Terminating a client results in a rollback of open
 # transactions for that client.
-# Set RUDE_QUIT to "NO" to disable.
+# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds.
 RUDE_QUIT="YES"
+RUDE_TIMEOUT=30
 
 # If the server still fails to shutdown, you can force it to quit by setting
 # this to yes and a recover-run will execute on the next startup.
-# Set FORCE_QUIT to "YES" to enable.
+# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds.
 FORCE_QUIT="NO"
+FORCE_TIMEOUT=2
 
 # Extra options to run postmaster with, e.g.:
 # -N is the maximal number of client connections
@@ -37,7 +43,7 @@ FORCE_QUIT="NO"
 ##############################################################################
 #
 # The following values should not be arbitrarily changed.
-# emerge --config dev-db/postgresql-server:8.2 uses these values to
+# emerge --config dev-db/postgresql-server:@SLOT@ uses these values to
 # determine where to create the data directory, where to place the
 # configuration files and any additional options you'd like to pass to initdb.
 #
@@ -47,10 +53,10 @@ FORCE_QUIT="NO"
 ##############################################################################
 
 # Location of configuration files
-PGDATA="/etc/postgresql-8.2/"
+PGDATA="/etc/postgresql-@SLOT@/"
 
 # Where the data directory is located/to be created
-DATA_DIR="/var/lib/postgresql/8.2/data"
+DATA_DIR="/var/lib/postgresql/@SLOT@/data"
 
 # Additional options to pass to initdb.
 # See 'man initdb' for available options.

diff --git a/postgresql.init b/postgresql.init
index d0ef87c..e51fa46 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -8,14 +8,14 @@ opts="${opts} reload"
 depend() {
 	use net
 	provide postgresql
-	provide postgresql-8.2
+	provide postgresql-@SLOT@
 }
 
 checkconfig() {
 	if [ ! -d $DATA_DIR ] ; then
 		eerror "Directory not found: $DATA_DIR"
 		eerror "Please make sure that DATA_DIR points to the right path."
-		eerror "You can run 'emerge --config dev-db/postgresql-server:8.2' to setup a new"
+		eerror "You can run 'emerge --config dev-db/postgresql-server:@SLOT@' to setup a new"
 		eerror "database cluster."
 		return 1
 	elif [ ! -f ${PGDATA%/}/postgresql.conf ] ; then
@@ -36,7 +36,7 @@ checkconfig() {
 	elif [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then
 		eerror "Socket conflict."
 		eerror "A server is already listening on:"
-		eerror "/var/run/postgresql/.s.PGSQL.${PGPORT}."
+		eerror "/var/run/postgresql/.s.PGSQL.${PGPORT}"
 		eerror "Change PGPORT to listen on a different socket."
 		return 1
 	fi
@@ -55,9 +55,9 @@ start() {
 
 	su -l postgres \
 		-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-		/usr/lib/postgresql-8.2/bin/pg_ctl \
-		start ${WAIT_FOR_START} -s -D ${DATA_DIR} -o \
-		'-D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}'"
+		/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+		start ${WAIT_FOR_START} -t ${START_TIMEOUT} -s -D ${DATA_DIR} \
+		-o '-D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}'"
 	retval=$?
 
 	if [ $retval -ne 0 ] ; then
@@ -68,26 +68,27 @@ start() {
 	# 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
 	# falsely reports the server as 'up'
-	if [ ! -f ${DATA_DIR}/postmaster.pid ] ; then
+	if [ ! -f ${DATA_DIR%/}/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
 
-	eend $?
+	eend $retval
 }
 
 stop() {
-	ebegin "Stopping PostgreSQL (this can take up to 90 seconds)"
+	ebegin "Stopping PostgreSQL (this can take up to $(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} )) seconds)"
 
 	local retval
 
 	if [ "${NICE_QUIT}" != "NO" ] ; then
 		su -l postgres \
 			-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-			/usr/lib/postgresql-8.2/bin/pg_ctl \
-			stop ${WAIT_FOR_STOP} -s -D ${DATA_DIR} -m smart"
+			/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+			stop ${WAIT_FOR_STOP} -t ${NICE_TIMEOUT} -s -D ${DATA_DIR} \
+			-m smart"
 		retval=$?
 
 		if [ $retval -eq 0 ] ; then
@@ -108,8 +109,9 @@ stop() {
 
 		su -l postgres \
 			-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-			/usr/lib/postgresql-8.2/bin/pg_ctl \
-			stop ${WAIT_FOR_STOP} -s -D ${DATA_DIR} -m fast"
+			/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+			stop ${WAIT_FOR_STOP} -t ${RUDE_TIMEOUT} -s -D ${DATA_DIR} \
+			-m fast"
 		retval=$?
 
 		if [ $retval -eq 0 ] ; then
@@ -129,8 +131,9 @@ stop() {
 
 		su -l postgres \
 			-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-			/usr/lib/postgresql-8.2/bin/pg_ctl \
-			stop ${WAIT_FOR_STOP} -s -D ${DATA_DIR} -m immediate"
+			/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+			stop ${WAIT_FOR_STOP} -t ${FORCE_TIMEOUT} -s -D ${DATA_DIR} \
+			-m immediate"
 
 		retval=$?
 
@@ -158,7 +161,7 @@ reload() {
 	ebegin "Reloading PostgreSQL configuration"
 	su -l postgres \
 		-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-		/usr/lib/postgresql-8.2/bin/pg_ctl \
+		/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
 		reload -s -D ${DATA_DIR}"
 	eend $?
 }
@@ -167,7 +170,7 @@ status() {
 	ebegin "Reloading PostgreSQL configuration"
 	su -l postgres \
 		-c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
-		/usr/lib/postgresql-8.2/bin/pg_ctl \
+		/usr/lib/postgresql-@SLOT@/bin/pg_ctl \
 		status -D ${DATA_DIR}"
 	eend $?
 }



             reply	other threads:[~2011-03-20  1:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-20  1:36 Aaron Swenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-23  1:52 [gentoo-commits] proj/pgsql-patches:initscripts commit in: / Mike Gilbert
2013-08-21  0:59 Aaron Swenson
2013-06-09  2:36 Aaron Swenson
2013-06-09  2:36 Aaron Swenson
2013-03-09 15:01 Aaron Swenson
2013-02-08 14:46 Aaron Swenson
2013-02-08 13:01 Aaron Swenson
2013-02-03 15:22 Aaron Swenson
2013-01-19 20:50 Aaron Swenson
2012-11-11 14:49 Aaron Swenson
2012-06-08 15:04 Aaron Swenson
2012-06-08 15:04 Aaron Swenson
2012-06-08 15:04 Aaron Swenson
2012-06-08 15:04 Aaron Swenson
2012-06-08 15:04 Aaron Swenson
2012-05-27 14:00 Aaron Swenson
2012-05-24 19:58 Aaron Swenson
2012-05-24 19:58 Aaron Swenson
2012-05-24 19:58 Aaron Swenson
2012-05-24 19:58 Aaron Swenson
2012-05-24 19:23 Aaron Swenson
2012-05-24 19:23 Aaron Swenson
2011-12-24 13:47 Aaron Swenson
2011-12-24 13:47 Aaron Swenson
2011-11-30 20:26 Aaron Swenson
2011-11-30 20:26 Aaron Swenson
2011-09-18 19:56 Aaron Swenson
2011-09-18 19:26 Aaron Swenson
2011-03-26 23:25 Aaron Swenson
2011-03-26 22:34 Aaron Swenson
2011-03-26  2:13 Aaron Swenson
2011-03-24 22:41 Aaron Swenson
2011-03-23  3:19 Aaron Swenson
2011-03-20  0:39 Aaron Swenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a43d11fff0d6eaded238d7c3c58689df3f73cee2.titanofold@gentoo \
    --to=titanofold@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox