* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-20 0:39 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-20 0:39 UTC (permalink / raw
To: gentoo-commits
commit: 858da0576419b108f058d3ed6eef46f3cc40999c
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 00:37:42 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 00:37:42 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=858da057
Initial commit of initscript and related conf file for 8.2.
---
postgresql.confd | 57 ++++++++++++++++++
postgresql.init | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 230 insertions(+), 0 deletions(-)
diff --git a/postgresql.confd b/postgresql.confd
new file mode 100644
index 0000000..e306c96
--- /dev/null
+++ b/postgresql.confd
@@ -0,0 +1,57 @@
+# Which port and socket to bind PostgreSQL
+PGPORT="5432"
+
+# Allow *_TIMEOUT to run its course.
+# Disable timeouts by changing to '-W' (capital W)
+WAIT_FOR_START="-w"
+WAIT_FOR_STOP="-w"
+
+# Ignore new connections and wait for clients to disconnect from server before
+# shutting down.
+# Set NICE_QUIT to "NO" to disable.
+NICE_QUIT="YES"
+
+# 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.
+RUDE_QUIT="YES"
+
+# 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.
+FORCE_QUIT="NO"
+
+# Extra options to run postmaster with, e.g.:
+# -N is the maximal number of client connections
+# -B is the number of shared buffers and has to be at least 2x the value for -N
+# Please read the man-page to postmaster for more options. Many of
+# these options can be set directly in the configuration file.
+#PGOPTS="-N 512 -B 1024"
+
+# Pass extra environment variables. If you have to export environment
+# variables for the database process, this can be done here.
+# Don't forget to escape quotes.
+#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\""
+
+##############################################################################
+#
+# The following values should not be arbitrarily changed.
+# emerge --config dev-db/postgresql-server:8.2 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.
+#
+# The init script also uses these variables to inform pg_ctl where to find
+# the same data and configuration files.
+#
+##############################################################################
+
+# Location of configuration files
+PGDATA="/etc/postgresql-8.2/"
+
+# Where the data directory is located/to be created
+DATA_DIR="/var/lib/postgresql/8.2/data"
+
+# Additional options to pass to initdb.
+# See 'man initdb' for available options.
+#PG_INITDB_OPTS="--locale=en_US.UTF-8"
diff --git a/postgresql.init b/postgresql.init
new file mode 100644
index 0000000..d0ef87c
--- /dev/null
+++ b/postgresql.init
@@ -0,0 +1,173 @@
+#!/sbin/runscript
+# Copyright 1999-2010 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,v 1.1 2010/06/04 14:18:52 patrick Exp $
+
+opts="${opts} reload"
+
+depend() {
+ use net
+ provide postgresql
+ provide postgresql-8.2
+}
+
+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 "database cluster."
+ return 1
+ elif [ ! -f ${PGDATA%/}/postgresql.conf ] ; then
+ eerror "File not found: ${PGDATA%/}/postgresql.conf"
+ eerror "You may need to run:"
+ eerror "cp ${DATA_DIR%/}/postgresql.conf ${PGDATA%/}/postgresql.conf"
+ return 1
+ elif [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then
+ eerror "File not found: ${PGDATA%/}/pg_hba.conf"
+ eerror "You may need to run:"
+ eerror "cp ${DATA_DIR%/}/pg_hba.conf ${PGDATA%/}/pg_hba.conf"
+ return 1
+ elif [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then
+ eerror "File not found: ${PGDATA%/}/pg_ident.conf"
+ eerror "You may need to run:"
+ eerror "cp ${DATA_DIR%/}/pg_ident.conf ${PGDATA%/}/pg_ident.conf"
+ return 1
+ 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 "Change PGPORT to listen on a different socket."
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting PostgreSQL"
+
+ if [ -f ${DATA_DIR%/}/postmaster.pid ] ; then
+ rm -f ${DATA_DIR%/}/postmaster.pid
+ fi
+
+ local retval
+
+ 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}'"
+ retval=$?
+
+ if [ $retval -ne 0 ] ; then
+ eend $retval
+ return $retval
+ fi
+
+ # 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
+ 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 $?
+}
+
+stop() {
+ ebegin "Stopping PostgreSQL (this can take up to 90 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"
+ retval=$?
+
+ if [ $retval -eq 0 ] ; then
+ eend $retval
+ return $retval
+ fi
+
+ ewarn "Shutting down the server gracefully failed."
+ ewarn "Probably because some clients did not disconnect within ${NICE_TIMEOUT} seconds."
+ else
+ ewarn "NICE_QUIT disabled."
+ ewarn "You really should have it enabled."
+ fi
+
+ if [ "${RUDE_QUIT}" != "NO" ] ; then
+ ewarn "RUDE_QUIT enabled."
+ ewarn "Going to shutdown the server anyway."
+
+ 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"
+ retval=$?
+
+ if [ $retval -eq 0 ] ; then
+ eend $retval
+ return $retval
+ fi
+
+ eerror "Failed to shutdown server."
+ else
+ ewarn "RUDE_QUIT disabled."
+ fi
+
+ if [ "${FORCE_QUIT}" = "YES" ] ; then
+ ewarn "FORCE_QUIT enabled."
+ ewarn "Forcing server to shutdown."
+ ewarn "A recover-run will be executed on the next startup."
+
+ 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"
+
+ retval=$?
+
+ if [ $retval -eq 0 ] ; then
+ ewarn "Server forced down."
+ eend $retval
+ return $retval
+ fi
+
+ eerror "Forced shutdown failed!!!"
+ eerror "Something is wrong with your system."
+ eerror "Please take care of it manually."
+ eerror "Unable to stop server."
+ eend $retval
+ return $retval
+ else
+ ewarn "FORCE_QUIT disabled."
+ eerror "Unable to shutdown server."
+ eend 1
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading PostgreSQL configuration"
+ su -l postgres \
+ -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
+ /usr/lib/postgresql-8.2/bin/pg_ctl \
+ reload -s -D ${DATA_DIR}"
+ eend $?
+}
+
+status() {
+ ebegin "Reloading PostgreSQL configuration"
+ su -l postgres \
+ -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
+ /usr/lib/postgresql-8.2/bin/pg_ctl \
+ status -D ${DATA_DIR}"
+ eend $?
+}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-20 1:36 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-20 1:36 UTC (permalink / raw
To: gentoo-commits
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 $?
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-23 3:19 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-23 3:19 UTC (permalink / raw
To: gentoo-commits
commit: e8efbbddf3279d45b51702f8465698b3c18ee7f6
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 03:18:25 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 03:18:25 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=e8efbbdd
Refactor checkconfig() and replaced cp instruction with a mv.
---
postgresql.init | 48 +++++++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index e51fa46..b44f93a 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2010 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,v 1.1 2010/06/04 14:18:52 patrick Exp $
+# $Header: $
opts="${opts} reload"
@@ -12,32 +12,34 @@ depend() {
}
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:@SLOT@' to setup a new"
- eerror "database cluster."
+ if [ ! -d ${DATA_DIR} ] ; then
+ eerror "Directory not found: ${DATA_DIR}"
+ eerror "HINT: Ensure that DATA_DIR points to the right path."
+ eerror "HINT: Or perhaps you need to create the database cluster:"
+ eerror " emerge --config dev-db/postgresql-server:@SLOT@"
return 1
- elif [ ! -f ${PGDATA%/}/postgresql.conf ] ; then
- eerror "File not found: ${PGDATA%/}/postgresql.conf"
- eerror "You may need to run:"
- eerror "cp ${DATA_DIR%/}/postgresql.conf ${PGDATA%/}/postgresql.conf"
- return 1
- elif [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then
- eerror "File not found: ${PGDATA%/}/pg_hba.conf"
- eerror "You may need to run:"
- eerror "cp ${DATA_DIR%/}/pg_hba.conf ${PGDATA%/}/pg_hba.conf"
- return 1
- elif [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then
- eerror "File not found: ${PGDATA%/}/pg_ident.conf"
- eerror "You may need to run:"
- eerror "cp ${DATA_DIR%/}/pg_ident.conf ${PGDATA%/}/pg_ident.conf"
+ fi
+ if [ ! -f ${PGDATA%/}/postgresql.conf -o \
+ ! -f ${PGDATA%/}/pg_hba.conf -o ! -f ${PGDATA%/}/pg_ident.conf ] ; then
+ eerror "The following file(s) were not found in ${PGDATA}:"
+ if [ ! -f ${PGDATA%/}/postgresql.conf ] ; then
+ eerror " postgresql.conf"
+ fi
+ if [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then
+ eerror " pg_hba.conf"
+ fi
+ if [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then
+ eerror " pg_ident.conf"
+ fi
+ eerror "HINT: Try:"
+ eerror "mv ${DATA_DIR%/}/*.conf ${PGDATA}"
return 1
- elif [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then
+ fi
+ if [ -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 "Change PGPORT to listen on a different socket."
+ eerror " /var/run/postgresql/.s.PGSQL.${PGPORT}"
+ eerror "HINT: Change PGPORT to listen on a different socket."
return 1
fi
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-24 22:41 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-24 22:41 UTC (permalink / raw
To: gentoo-commits
commit: 967915a2ce323a6d1eba2abde16ecbb0453b0d0e
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 24 22:39:41 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu Mar 24 22:39:41 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=967915a2
Added a message to direct users to check their Postgresql log for an error
message explaining why there's a failure.
---
postgresql.init | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index b44f93a..26e1b8b 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -63,6 +63,7 @@ start() {
retval=$?
if [ $retval -ne 0 ] ; then
+ eerror "Check the PostgreSQL @SLOT@ log for a detailed explanation of the above error."
eend $retval
return $retval
fi
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-26 2:13 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-26 2:13 UTC (permalink / raw
To: gentoo-commits
commit: 44140402fb5ae05d75b43e9dde84f11d6c036dcd
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 02:09:12 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 02:09:12 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=44140402
Working towards file permission checking.
---
postgresql.init | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 26e1b8b..b7ee23e 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -12,6 +12,10 @@ depend() {
}
checkconfig() {
+ if [ -z ${DATA_DIR} ] ; then
+ eerror "DATA_DIR not set"
+ eerror "HINT: Did you not update /etc/conf.d/postgresql-@SLOT@"
+ fi
if [ ! -d ${DATA_DIR} ] ; then
eerror "Directory not found: ${DATA_DIR}"
eerror "HINT: Ensure that DATA_DIR points to the right path."
@@ -19,22 +23,23 @@ checkconfig() {
eerror " emerge --config dev-db/postgresql-server:@SLOT@"
return 1
fi
- if [ ! -f ${PGDATA%/}/postgresql.conf -o \
- ! -f ${PGDATA%/}/pg_hba.conf -o ! -f ${PGDATA%/}/pg_ident.conf ] ; then
+ if [ ! -f ${PGDATA}/postgresql.conf -o \
+ ! -f ${PGDATA}/pg_hba.conf -o ! -f ${PGDATA}/pg_ident.conf ] ; then
eerror "The following file(s) were not found in ${PGDATA}:"
- if [ ! -f ${PGDATA%/}/postgresql.conf ] ; then
+ if [ ! -f ${PGDATA}/postgresql.conf ] ; then
eerror " postgresql.conf"
fi
- if [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then
+ if [ ! -f ${PGDATA}/pg_hba.conf ] ; then
eerror " pg_hba.conf"
fi
- if [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then
+ if [ ! -f ${PGDATA}/pg_ident.conf ] ; then
eerror " pg_ident.conf"
fi
eerror "HINT: Try:"
- eerror "mv ${DATA_DIR%/}/*.conf ${PGDATA}"
+ eerror "mv ${DATA_DIR}/*.conf ${PGDATA}"
return 1
fi
+
if [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
@@ -49,8 +54,8 @@ start() {
ebegin "Starting PostgreSQL"
- if [ -f ${DATA_DIR%/}/postmaster.pid ] ; then
- rm -f ${DATA_DIR%/}/postmaster.pid
+ if [ -f ${DATA_DIR}/postmaster.pid ] ; then
+ rm -f ${DATA_DIR}/postmaster.pid
fi
local retval
@@ -71,7 +76,7 @@ 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
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-26 22:34 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-26 22:34 UTC (permalink / raw
To: gentoo-commits
commit: 72decd1f9b8c387c126702b1cd636b8edeb613b0
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 22:32:01 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 22:32:01 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=72decd1f
Added permiission checks. Changed ${VAR%/} to just ${VAR} because the latter is
POSIX compliant while the former is a BASH extension.
---
postgresql.init | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index b7ee23e..c6c80a5 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -26,20 +26,26 @@ checkconfig() {
if [ ! -f ${PGDATA}/postgresql.conf -o \
! -f ${PGDATA}/pg_hba.conf -o ! -f ${PGDATA}/pg_ident.conf ] ; then
eerror "The following file(s) were not found in ${PGDATA}:"
- if [ ! -f ${PGDATA}/postgresql.conf ] ; then
- eerror " postgresql.conf"
- fi
- if [ ! -f ${PGDATA}/pg_hba.conf ] ; then
- eerror " pg_hba.conf"
- fi
- if [ ! -f ${PGDATA}/pg_ident.conf ] ; then
- eerror " pg_ident.conf"
- fi
+ [ ! -f ${PGDATA}/postgresql.conf ] && eerror " postgresql.conf"
+ [ ! -f ${PGDATA}/pg_hba.conf ] && eerror " pg_hba.conf"
+ [ ! -f ${PGDATA}/pg_ident.conf ] && eerror " pg_ident.conf"
eerror "HINT: Try:"
eerror "mv ${DATA_DIR}/*.conf ${PGDATA}"
return 1
fi
-
+ local file
+ local failed
+ for file in pg_hba pg_ident postgresql ; do
+ file="${PGDATA}/${file}.conf"
+ su postgres -c "test -r ${file}" || failed=" ${file}
+${failed}"
+ done
+ if [ -n "${failed}" ] ; then
+ eerror "The following file(s) are not readable by 'postgres':"
+ eerror "${failed}"
+ eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'"
+ return 1
+ fi
if [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-03-26 23:25 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-03-26 23:25 UTC (permalink / raw
To: gentoo-commits
commit: 022034478406b7d63aedf6d3505aa81ccc5c832e
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 23:24:26 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 23:24:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=02203447
Beautified output a bit.
---
postgresql.init | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index c6c80a5..ffd6c55 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -37,12 +37,14 @@ checkconfig() {
local failed
for file in pg_hba pg_ident postgresql ; do
file="${PGDATA}/${file}.conf"
- su postgres -c "test -r ${file}" || failed=" ${file}
-${failed}"
+ su postgres -c "test -r ${file}" || failed="${file} ${failed}"
done
if [ -n "${failed}" ] ; then
eerror "The following file(s) are not readable by 'postgres':"
- eerror "${failed}"
+ local x
+ for x in ${failed} ; do
+ eerror " ${x}"
+ done
eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'"
return 1
fi
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-09-18 19:26 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-09-18 19:26 UTC (permalink / raw
To: gentoo-commits
commit: d522eeff49e2c428b9873e640e3a779a5bbf7731
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 19:25:41 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 19:25:41 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=d522eeff
Added {,/var}/run creation and updated README to match up with these files.
---
README | 30 +++++++++++++-----------------
postgresql.init | 14 ++++++++++++--
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/README b/README
index 91a55f0..42cd086 100644
--- a/README
+++ b/README
@@ -1,22 +1,18 @@
-This repository is split into three primary branches.
+===========
+Initscripts
+===========
-Patches
--------------------------------------------------------------------------------
-The 'patches' branch is further split to match the major versions
-versions (a.k.a., slots). Pay attention to the tags as the signify the highest
-version they work with.
+postgresql.confd and postgresql.init have been written to condense the number of
+files that are necessary for maintenance. The dev-db/postgresql-server ebuilds
+sed the files replacing @SLOT@ with the proper slot number and @RUN@ with either
+/run or /var/run, depending on if /run exists.
-Those files are then manually rolled into a tarball and hosted at
-'http://d.g.o/~titanofold/'.
+These files are then manually tarballed and hosted at
+http://dev.gentoo.org/~titanofold/.
-Init Scripts
--------------------------------------------------------------------------------
-The 'initscripts' branch contains the initscripts. These scripts have been
-written to condense the number of files that are necessary for maintenance.
+Versioning
+==========
-
-Eselect Module
--------------------------------------------------------------------------------
-The 'eselect' branch contains the actual script for library and binary
-management.
+The minor version is incremented anytime a bug is fixed. The major version is
+incremented anytime a feature or capability is added.
diff --git a/postgresql.init b/postgresql.init
index ffd6c55..cda6d84 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -12,6 +12,7 @@ depend() {
}
checkconfig() {
+ # Check that DATA_DIR has been set and exists
if [ -z ${DATA_DIR} ] ; then
eerror "DATA_DIR not set"
eerror "HINT: Did you not update /etc/conf.d/postgresql-@SLOT@"
@@ -23,6 +24,8 @@ checkconfig() {
eerror " emerge --config dev-db/postgresql-server:@SLOT@"
return 1
fi
+
+ # Check for the existence of and PostgreSQL's ability to read the config files.
if [ ! -f ${PGDATA}/postgresql.conf -o \
! -f ${PGDATA}/pg_hba.conf -o ! -f ${PGDATA}/pg_ident.conf ] ; then
eerror "The following file(s) were not found in ${PGDATA}:"
@@ -48,10 +51,17 @@ checkconfig() {
eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'"
return 1
fi
- if [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then
+
+ # Ensures @RUN@/postgresql exists for those who have it on tmpfs.
+ local runpath="@RUN@/postgresql"
+ if [ ! -d ${runpath} ] ; then
+ mkdir -p ${runpath}
+ chown postgres:postgres ${runpath}
+ fi
+ if [ -e ${runpath}/.s.PGSQL.${PGPORT} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
- eerror " /var/run/postgresql/.s.PGSQL.${PGPORT}"
+ eerror " ${runpath}/.s.PGSQL.${PGPORT}"
eerror "HINT: Change PGPORT to listen on a different socket."
return 1
fi
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-09-18 19:56 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-09-18 19:56 UTC (permalink / raw
To: gentoo-commits
commit: 1876f40d5d60301d910707191cb5f683c48eb580
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 19:55:46 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 19:55:46 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=1876f40d
Drop variable for real paths
---
postgresql.init | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index cda6d84..fa0f90c 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -52,16 +52,15 @@ checkconfig() {
return 1
fi
- # Ensures @RUN@/postgresql exists for those who have it on tmpfs.
- local runpath="@RUN@/postgresql"
- if [ ! -d ${runpath} ] ; then
- mkdir -p ${runpath}
- chown postgres:postgres ${runpath}
+ # Ensures @RUN@ exists for those who have it on tmpfs.
+ if [ ! -d @RUN@ ] ; then
+ mkdir -p @RUN@
+ chown postgres:postgres @RUN@
fi
- if [ -e ${runpath}/.s.PGSQL.${PGPORT} ] ; then
+ if [ -e @RUN@/.s.PGSQL.${PGPORT} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
- eerror " ${runpath}/.s.PGSQL.${PGPORT}"
+ eerror " @RUN@/.s.PGSQL.${PGPORT}"
eerror "HINT: Change PGPORT to listen on a different socket."
return 1
fi
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-11-30 20:26 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-11-30 20:26 UTC (permalink / raw
To: gentoo-commits
commit: 2d3cf86ebfa383bb5a6f159902569beaa3c55bb2
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 30 15:32:15 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Wed Nov 30 15:32:15 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=2d3cf86e
Updated to match postgresql.init.
---
postgresql.confd | 39 +++++++++++++++++----------------------
1 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/postgresql.confd b/postgresql.confd
index d9dc7fd..b0e1308 100644
--- a/postgresql.confd
+++ b/postgresql.confd
@@ -1,29 +1,23 @@
# Which port and socket to bind PostgreSQL
PGPORT="5432"
-# Allow *_TIMEOUT to run its course.
-# Disable timeouts by changing to '-W' (capital W)
-WAIT_FOR_START="-w"
-WAIT_FOR_STOP="-w"
-
# How long to wait for server to start in seconds
-START_TIMEOUT=60
+START_TIMEOUT=10
-# Ignore new connections and wait for clients to disconnect from server before
-# shutting down.
-# Set NICE_QUIT to "NO" to disable. NICE_TIMEOUT in seconds.
-NICE_QUIT="YES"
+# NICE_QUIT ignores new connections and wait for clients to disconnect from
+# server before shutting down. NICE_TIMEOUT in seconds determines how long to
+# wait for this to succeed.
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.
+# after NICE_QUIT. Terminated client connections have their open transactions
+# rolled back.
# 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.
+# this to YES and a recover-run will execute on the next startup.
# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds.
FORCE_QUIT="NO"
FORCE_TIMEOUT=2
@@ -31,24 +25,25 @@ FORCE_TIMEOUT=2
# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections
# -B is the number of shared buffers and has to be at least 2x the value for -N
-# Please read the man-page to postmaster for more options. Many of
-# these options can be set directly in the configuration file.
+# Please read the man-page to postmaster for more options. Many of these
+# options can be set directly in the configuration file.
#PGOPTS="-N 512 -B 1024"
-# Pass extra environment variables. If you have to export environment
-# variables for the database process, this can be done here.
+# Pass extra environment variables. If you have to export environment variables
+# for the database process, this can be done here.
# Don't forget to escape quotes.
#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\""
##############################################################################
#
# The following values should not be arbitrarily changed.
-# emerge --config dev-db/postgresql-server:@SLOT@ 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.
+# configuration files, and any additional options to pass to initdb.
#
-# The init script also uses these variables to inform pg_ctl where to find
-# the same data and configuration files.
+# The initscript also uses these variables to inform PostgreSQL where to find
+# its data directory and configuration files.
#
##############################################################################
@@ -59,5 +54,5 @@ PGDATA="/etc/postgresql-@SLOT@/"
DATA_DIR="/var/lib/postgresql/@SLOT@/data"
# Additional options to pass to initdb.
-# See 'man initdb' for available options.
+# See `man initdb' for available options.
#PG_INITDB_OPTS="--locale=en_US.UTF-8"
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-11-30 20:26 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-11-30 20:26 UTC (permalink / raw
To: gentoo-commits
commit: 4795d6dffdd82a8948ff95d39ec23266094d983c
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 30 13:50:33 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Wed Nov 30 13:50:33 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=4795d6df
Move to start-stop-daemon. Create run directory if it doesn't exist.
Parse postgresql.conf for port, unix_socket_directory, and
log_destination allowing postgresql.conf to override
/etc/conf.d/postgresql.
---
postgresql.init | 165 +++++++++++++++++--------------------------------------
1 files changed, 50 insertions(+), 115 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index fa0f90c..a00c9c9 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -3,19 +3,33 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: $
-opts="${opts} reload"
+extra_started_command="reload"
+
+get_config() {
+ [ -f ${PGDATA}/postgresql.conf ] || return 1
+
+ eval echo $(sed -e 's:#.*::' ${PGDATA}/postgresql.conf | awk '$1 == "'$1'" { print $2 == "=" ? $3 : $2 }')
+}
depend() {
- use net
- provide postgresql
- provide postgresql-@SLOT@
+ use net
+ provide postgresql
+
+ if [ "$(get_config log_destination)" = "syslog" ]; then
+ use logger
+ fi
}
+configured_port=$(get_config port)
+: ${configured_port:=${PGPORT}}
+socket_path=$(get_config unix_socket_path)
+: ${socket_path:=@RUNDIR@/run/postgresql}
+
checkconfig() {
# Check that DATA_DIR has been set and exists
if [ -z ${DATA_DIR} ] ; then
eerror "DATA_DIR not set"
- eerror "HINT: Did you not update /etc/conf.d/postgresql-@SLOT@"
+ eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
fi
if [ ! -d ${DATA_DIR} ] ; then
eerror "Directory not found: ${DATA_DIR}"
@@ -32,10 +46,11 @@ checkconfig() {
[ ! -f ${PGDATA}/postgresql.conf ] && eerror " postgresql.conf"
[ ! -f ${PGDATA}/pg_hba.conf ] && eerror " pg_hba.conf"
[ ! -f ${PGDATA}/pg_ident.conf ] && eerror " pg_ident.conf"
- eerror "HINT: Try:"
- eerror "mv ${DATA_DIR}/*.conf ${PGDATA}"
+ eerror "HINT: Try:"
+ eerror " mv ${DATA_DIR}/*.conf ${PGDATA}"
return 1
fi
+
local file
local failed
for file in pg_hba pg_ident postgresql ; do
@@ -52,15 +67,11 @@ checkconfig() {
return 1
fi
- # Ensures @RUN@ exists for those who have it on tmpfs.
- if [ ! -d @RUN@ ] ; then
- mkdir -p @RUN@
- chown postgres:postgres @RUN@
- fi
- if [ -e @RUN@/.s.PGSQL.${PGPORT} ] ; then
- eerror "Socket conflict."
+ checkpath -d -m 0770 -o postgres:postgres ${socket_path}
+ if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
+ eerror "Socket conflict."
eerror "A server is already listening on:"
- eerror " @RUN@/.s.PGSQL.${PGPORT}"
+ eerror " ${socket_path}/.s.PGSQL.${configured_port}"
eerror "HINT: Change PGPORT to listen on a different socket."
return 1
fi
@@ -71,17 +82,17 @@ start() {
ebegin "Starting PostgreSQL"
- if [ -f ${DATA_DIR}/postmaster.pid ] ; then
- rm -f ${DATA_DIR}/postmaster.pid
- fi
+ rm -f ${DATA_DIR}/postmaster.pid
local retval
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /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}'"
+ start-stop-daemon --start \
+ --user postgres \
+ --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
+ --env "PGPORT=${configured_port} ${PG_EXTRA_ENV}" \
+ --wait $((${START_TIMEOUT}*1000)) \
+ --pidfile ${DATA_DIR}/postmaster.pid \
+ -- -D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}
retval=$?
if [ $retval -ne 0 ] ; then
@@ -90,112 +101,36 @@ start() {
return $retval
fi
- # 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
- 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 $retval
}
stop() {
- ebegin "Stopping PostgreSQL (this can take up to $(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} )) seconds)"
+ local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
+ ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"
local retval
-
- if [ "${NICE_QUIT}" != "NO" ] ; then
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /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
- eend $retval
- return $retval
- fi
-
- ewarn "Shutting down the server gracefully failed."
- ewarn "Probably because some clients did not disconnect within ${NICE_TIMEOUT} seconds."
- else
- ewarn "NICE_QUIT disabled."
- ewarn "You really should have it enabled."
- fi
+ local retries=SIGTERM/$((${NICE_TIMEOUT}*1000))
if [ "${RUDE_QUIT}" != "NO" ] ; then
- ewarn "RUDE_QUIT enabled."
- ewarn "Going to shutdown the server anyway."
-
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /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
- eend $retval
- return $retval
- fi
-
- eerror "Failed to shutdown server."
- else
- ewarn "RUDE_QUIT disabled."
+ einfo "RUDE_QUIT enabled."
+ retries="${retries}/SIGINT/$((${RUDE_TIMEOUT}*1000))"
fi
-
if [ "${FORCE_QUIT}" = "YES" ] ; then
- ewarn "FORCE_QUIT enabled."
- ewarn "Forcing server to shutdown."
- ewarn "A recover-run will be executed on the next startup."
-
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
- stop ${WAIT_FOR_STOP} -t ${FORCE_TIMEOUT} -s -D ${DATA_DIR} \
- -m immediate"
-
- retval=$?
-
- if [ $retval -eq 0 ] ; then
- ewarn "Server forced down."
- eend $retval
- return $retval
- fi
-
- eerror "Forced shutdown failed!!!"
- eerror "Something is wrong with your system."
- eerror "Please take care of it manually."
- eerror "Unable to stop server."
- eend $retval
- return $retval
- else
- ewarn "FORCE_QUIT disabled."
- eerror "Unable to shutdown server."
- eend 1
- return 1
+ einfo "FORCE_QUIT enabled."
+ ewarn "A recover-run might be executed on next startup."
+ retries="${retries}/SIGQUIT/$((${FORCE_TIMEOUT}*1000))"
fi
-}
-reload() {
- ebegin "Reloading PostgreSQL configuration"
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
- reload -s -D ${DATA_DIR}"
- eend $?
+ start-stop-daemon --stop \
+ --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
+ --retry ${retries} \
+ --pidfile ${DATA_DIR}/postmaster.pid
+
+ eend
}
-status() {
+reload() {
ebegin "Reloading PostgreSQL configuration"
- su -l postgres \
- -c "env PGPORT=\"${PGPORT}\" ${PG_EXTRA_ENV} \
- /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
- status -D ${DATA_DIR}"
+ kill -HUP $(head -n1 ${DATA_DIR}/postmaster.pid)
eend $?
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-12-24 13:47 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-12-24 13:47 UTC (permalink / raw
To: gentoo-commits
commit: 8f36b38642832f500e0bbcb83f0026b365a4d070
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 24 13:46:54 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Dec 24 13:46:54 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=8f36b386
Fixed passing environments issue. (Bug 394159)
---
postgresql.init | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index ed1dea4..363ea1a 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -69,7 +69,7 @@ checkconfig() {
checkpath -d -m 0770 -o postgres:postgres ${socket_path}
if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
- eerror "Socket conflict."
+ eerror "Socket conflict."
eerror "A server is already listening on:"
eerror " ${socket_path}/.s.PGSQL.${configured_port}"
eerror "HINT: Change PGPORT to listen on a different socket."
@@ -84,16 +84,21 @@ start() {
rm -f ${DATA_DIR}/postmaster.pid
- local retval
+ local extraenv
+ local x
+ for x in ${PG_EXTRA_ENV} ; do
+ extraenv="${extraenv} --env ${x}"
+ done
start-stop-daemon --start \
--user postgres \
--exec /usr/lib/postgresql-@SLOT@/bin/postgres \
- --env "PGPORT=${configured_port} ${PG_EXTRA_ENV}" \
+ --env "PGPORT=${configured_port}" \
+ ${extraenv} \
--wait $((${START_TIMEOUT}*1000)) \
--pidfile ${DATA_DIR}/postmaster.pid \
-- -D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}
- retval=$?
+ local retval=$?
if [ $retval -ne 0 ] ; then
eerror "Check the PostgreSQL @SLOT@ log for a detailed explanation of the above error."
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2011-12-24 13:47 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2011-12-24 13:47 UTC (permalink / raw
To: gentoo-commits
commit: 3c1052f01e6e9bb4deb96acb1a2a17291f409d79
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 20 14:56:59 2011 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Tue Dec 20 14:56:59 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=3c1052f0
Fixed typo.
---
postgresql.init | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index a00c9c9..ed1dea4 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -3,7 +3,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: $
-extra_started_command="reload"
+extra_started_commands="reload"
get_config() {
[ -f ${PGDATA}/postgresql.conf ] || return 1
@@ -109,16 +109,16 @@ stop() {
ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"
local retval
- local retries=SIGTERM/$((${NICE_TIMEOUT}*1000))
+ local retries=SIGTERM/${NICE_TIMEOUT}
if [ "${RUDE_QUIT}" != "NO" ] ; then
einfo "RUDE_QUIT enabled."
- retries="${retries}/SIGINT/$((${RUDE_TIMEOUT}*1000))"
+ retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
fi
if [ "${FORCE_QUIT}" = "YES" ] ; then
einfo "FORCE_QUIT enabled."
ewarn "A recover-run might be executed on next startup."
- retries="${retries}/SIGQUIT/$((${FORCE_TIMEOUT}*1000))"
+ retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
fi
start-stop-daemon --stop \
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:23 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:23 UTC (permalink / raw
To: gentoo-commits
commit: d8732f86c3fe03b224bdeb5d7575de29ab8bc779
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Wed May 23 18:48:38 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Wed May 23 18:48:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=d8732f86
Fixed startup command for 9.2. Refactored config file check.
---
postgresql.init | 200 ++++++++++++++++++++++++++----------------------------
1 files changed, 96 insertions(+), 104 deletions(-)
diff --git a/postgresql.init b/postgresql.init
old mode 100644
new mode 100755
index 363ea1a..ec31748
--- a/postgresql.init
+++ b/postgresql.init
@@ -16,7 +16,7 @@ depend() {
provide postgresql
if [ "$(get_config log_destination)" = "syslog" ]; then
- use logger
+ use logger
fi
}
@@ -26,116 +26,108 @@ socket_path=$(get_config unix_socket_path)
: ${socket_path:=@RUNDIR@/run/postgresql}
checkconfig() {
- # Check that DATA_DIR has been set and exists
- if [ -z ${DATA_DIR} ] ; then
- eerror "DATA_DIR not set"
- eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
- fi
- if [ ! -d ${DATA_DIR} ] ; then
- eerror "Directory not found: ${DATA_DIR}"
- eerror "HINT: Ensure that DATA_DIR points to the right path."
- eerror "HINT: Or perhaps you need to create the database cluster:"
- eerror " emerge --config dev-db/postgresql-server:@SLOT@"
- return 1
- fi
-
- # Check for the existence of and PostgreSQL's ability to read the config files.
- if [ ! -f ${PGDATA}/postgresql.conf -o \
- ! -f ${PGDATA}/pg_hba.conf -o ! -f ${PGDATA}/pg_ident.conf ] ; then
- eerror "The following file(s) were not found in ${PGDATA}:"
- [ ! -f ${PGDATA}/postgresql.conf ] && eerror " postgresql.conf"
- [ ! -f ${PGDATA}/pg_hba.conf ] && eerror " pg_hba.conf"
- [ ! -f ${PGDATA}/pg_ident.conf ] && eerror " pg_ident.conf"
- eerror "HINT: Try:"
- eerror " mv ${DATA_DIR}/*.conf ${PGDATA}"
- return 1
- fi
-
- local file
- local failed
- for file in pg_hba pg_ident postgresql ; do
- file="${PGDATA}/${file}.conf"
- su postgres -c "test -r ${file}" || failed="${file} ${failed}"
- done
- if [ -n "${failed}" ] ; then
- eerror "The following file(s) are not readable by 'postgres':"
- local x
- for x in ${failed} ; do
- eerror " ${x}"
- done
- eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'"
- return 1
- fi
-
- checkpath -d -m 0770 -o postgres:postgres ${socket_path}
- if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
- eerror "Socket conflict."
- eerror "A server is already listening on:"
- eerror " ${socket_path}/.s.PGSQL.${configured_port}"
- eerror "HINT: Change PGPORT to listen on a different socket."
- return 1
- fi
+ # Check that DATA_DIR has been set and exists
+ if [ -z ${DATA_DIR} ] ; then
+ eerror "DATA_DIR not set"
+ eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
+ fi
+ if [ ! -d ${DATA_DIR} ] ; then
+ eerror "Directory not found: ${DATA_DIR}"
+ eerror "HINT: Ensure that DATA_DIR points to the right path."
+ eerror "HINT: Or perhaps you need to create the database cluster:"
+ eerror " emerge --config dev-db/postgresql-server:@SLOT@"
+ return 1
+ fi
+
+ # Check for the existence of PostgreSQL's config files.
+ local file
+ local status=0
+ for file in postgresql pg_hba pg_ident ; do
+ file="${PGDATA}/${file}.conf"
+ if [ -f ${file} ] ; then
+ checkpath -f -m 0600 -o postgres:postgres ${file}
+ else
+ eerror "${file} not found"
+ status=1
+ fi
+ done
+ if [ ${status} ] ; then
+ eerror "HINT: Try:"
+ eerror " mv ${DATA_DIR}/*.conf ${PGDATA}"
+ return 1
+ fi
+
+ # Check the socket directory
+ checkpath -d -m 0770 -o postgres:postgres ${socket_path}
+ if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
+ eerror "Socket conflict."
+ eerror "A server is already listening on:"
+ eerror " ${socket_path}/.s.PGSQL.${configured_port}"
+ eerror "HINT: Change PGPORT to listen on a different socket."
+ return 1
+ fi
}
start() {
- checkconfig || return 1
-
- ebegin "Starting PostgreSQL"
-
- rm -f ${DATA_DIR}/postmaster.pid
-
- local extraenv
- local x
- for x in ${PG_EXTRA_ENV} ; do
- extraenv="${extraenv} --env ${x}"
- done
-
- start-stop-daemon --start \
- --user postgres \
- --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
- --env "PGPORT=${configured_port}" \
- ${extraenv} \
- --wait $((${START_TIMEOUT}*1000)) \
- --pidfile ${DATA_DIR}/postmaster.pid \
- -- -D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}
- local retval=$?
-
- if [ $retval -ne 0 ] ; then
- eerror "Check the PostgreSQL @SLOT@ log for a detailed explanation of the above error."
- eend $retval
- return $retval
- fi
-
- eend $retval
+ checkconfig || return 1
+
+ ebegin "Starting PostgreSQL"
+
+ rm -f ${DATA_DIR}/postmaster.pid
+
+ local extraenv
+ local x
+ for x in ${PG_EXTRA_ENV} ; do
+ extraenv="${extraenv} --env ${x}"
+ done
+
+ start-stop-daemon --start \
+ --user postgres \
+ --env "PGPORT=${configured_port}" \
+ ${extraenv} \
+ --pidfile ${DATA_DIR}/postmaster.pid \
+ --exec /usr/bin/pg_ctl@SLOT@ \
+ -- start -s -l ${DATA_DIR}/postmaster.log -D ${PGDATA} \
+ -o "--data-directory=${DATA_DIR} ${PGOPTS}"
+ local retval=$?
+
+ if [ $retval -ne 0 ] ; then
+ eerror "Check the log for a possible explanation of the above error."
+ eerror " ${DATA_DIR}/postmaster.log"
+ eend $retval
+ return $retval
+ fi
+
+ eend $retval
}
stop() {
- local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
- ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"
-
- local retval
- local retries=SIGTERM/${NICE_TIMEOUT}
-
- if [ "${RUDE_QUIT}" != "NO" ] ; then
- einfo "RUDE_QUIT enabled."
- retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
- fi
- if [ "${FORCE_QUIT}" = "YES" ] ; then
- einfo "FORCE_QUIT enabled."
- ewarn "A recover-run might be executed on next startup."
- retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
- fi
-
- start-stop-daemon --stop \
- --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
- --retry ${retries} \
- --pidfile ${DATA_DIR}/postmaster.pid
-
- eend
+ local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
+ ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"
+
+ local retval
+ local retries=SIGTERM/${NICE_TIMEOUT}
+
+ if [ "${RUDE_QUIT}" != "NO" ] ; then
+ einfo "RUDE_QUIT enabled."
+ retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
+ fi
+ if [ "${FORCE_QUIT}" = "YES" ] ; then
+ einfo "FORCE_QUIT enabled."
+ ewarn "A recover-run might be executed on next startup."
+ retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
+ fi
+
+ start-stop-daemon --stop \
+ --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
+ --retry ${retries} \
+ --pidfile ${DATA_DIR}/postmaster.pid
+
+ eend
}
reload() {
- ebegin "Reloading PostgreSQL configuration"
- kill -HUP $(head -n1 ${DATA_DIR}/postmaster.pid)
- eend $?
+ ebegin "Reloading PostgreSQL configuration"
+ kill -HUP $(head -n1 ${DATA_DIR}/postmaster.pid)
+ eend $?
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:23 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 90842709ac3985fe8e714645905f33c63e96426c
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 19:22:18 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu May 24 19:22:18 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=90842709
Cleaned up commands. Remove trailing slash for paths.
---
postgresql.init | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index ec31748..c92aee7 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -26,7 +26,7 @@ socket_path=$(get_config unix_socket_path)
: ${socket_path:=@RUNDIR@/run/postgresql}
checkconfig() {
- # Check that DATA_DIR has been set and exists
+ # Check that DATA_DIR has been set and exists
if [ -z ${DATA_DIR} ] ; then
eerror "DATA_DIR not set"
eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
@@ -43,7 +43,7 @@ checkconfig() {
local file
local status=0
for file in postgresql pg_hba pg_ident ; do
- file="${PGDATA}/${file}.conf"
+ file="${PGDATA%/}/${file}.conf"
if [ -f ${file} ] ; then
checkpath -f -m 0600 -o postgres:postgres ${file}
else
@@ -53,16 +53,16 @@ checkconfig() {
done
if [ ${status} ] ; then
eerror "HINT: Try:"
- eerror " mv ${DATA_DIR}/*.conf ${PGDATA}"
+ eerror " mv ${DATA_DIR%/}/*.conf ${PGDATA}"
return 1
fi
# Check the socket directory
checkpath -d -m 0770 -o postgres:postgres ${socket_path}
- if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
+ if [ -e ${socket_path%/}/.s.PGSQL.${configured_port} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
- eerror " ${socket_path}/.s.PGSQL.${configured_port}"
+ eerror " ${socket_path%/}/.s.PGSQL.${configured_port}"
eerror "HINT: Change PGPORT to listen on a different socket."
return 1
fi
@@ -86,9 +86,9 @@ start() {
--env "PGPORT=${configured_port}" \
${extraenv} \
--pidfile ${DATA_DIR}/postmaster.pid \
- --exec /usr/bin/pg_ctl@SLOT@ \
- -- start -s -l ${DATA_DIR}/postmaster.log -D ${PGDATA} \
- -o "--data-directory=${DATA_DIR} ${PGOPTS}"
+ --exec /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+ -- start -s -w -t ${START_TIMEOUT} -l ${DATA_DIR}/postmaster.log \
+ -D ${PGDATA} -o "--data-directory=${DATA_DIR} ${PGOPTS}"
local retval=$?
if [ $retval -ne 0 ] ; then
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:58 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:58 UTC (permalink / raw
To: gentoo-commits
commit: 0bd46073b45a57809b2ff7a85ebb39f72681f253
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 19:26:05 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu May 24 19:26:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=0bd46073
Don't just check for the variable, but see if it's true!
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 06f2d23..ae3c561 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -51,7 +51,7 @@ checkconfig() {
status=1
fi
done
- if [ ${status} ] ; then
+ if [ ${status} -eq 1 ] ; then
eerror "HINT: Try:"
eerror " mv ${DATA_DIR%/}/*.conf ${PGDATA}"
return 1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:58 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:58 UTC (permalink / raw
To: gentoo-commits
commit: b53e8b00b876c4b28bf4df30d32f505b8ec565db
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 19:56:00 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu May 24 19:56:00 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=b53e8b00
Just bail out if one of the configuration files is missing. The hint
directs them to move over '*.conf' anyway.
---
postgresql.init | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 8217299..1dabe2b 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -41,21 +41,16 @@ checkconfig() {
# Check for the existence of PostgreSQL's config files.
local file
- local status=0
for file in postgresql pg_hba pg_ident ; do
file="${PGDATA%/}/${file}.conf"
if [ -f ${file} ] ; then
checkpath -f -m 0600 -o postgres:postgres ${file}
else
eerror "${file} not found"
- status=1
+ eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}"
+ return 1
fi
done
- if [ ${status} -eq 1 ] ; then
- eerror "HINT: Try:"
- eerror " mv ${DATA_DIR%/}/*.conf ${PGDATA}"
- return 1
- fi
# Check the socket directory
checkpath -d -m 0770 -o postgres:postgres ${socket_path}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:58 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:58 UTC (permalink / raw
To: gentoo-commits
commit: 9031a6f2c6825cd99da48952f44165d64f575192
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 19:46:29 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu May 24 19:46:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=9031a6f2
Missed a path variable.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index ae3c561..8217299 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -8,7 +8,7 @@ extra_started_commands="reload"
get_config() {
[ -f ${PGDATA}/postgresql.conf ] || return 1
- eval echo $(sed -e 's:#.*::' ${PGDATA}/postgresql.conf | awk '$1 == "'$1'" { print $2 == "=" ? $3 : $2 }')
+ eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf | awk '$1 == "'$1'" { print $2 == "=" ? $3 : $2 }')
}
depend() {
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-24 19:58 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-24 19:58 UTC (permalink / raw
To: gentoo-commits
commit: f324d8c94efcdbc5ee38f8ca040612cc34836e14
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 19:24:07 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Thu May 24 19:24:07 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=f324d8c9
If syslog is specified in postgresql.conf, we need it.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index c92aee7..06f2d23 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -16,7 +16,7 @@ depend() {
provide postgresql
if [ "$(get_config log_destination)" = "syslog" ]; then
- use logger
+ need logger
fi
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-05-27 14:00 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-05-27 14:00 UTC (permalink / raw
To: gentoo-commits
commit: 9d53c458db3bf66f9784ed995d257766bf9468c5
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun May 27 13:57:59 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun May 27 13:57:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=9d53c458
Return if DATA_DIR hasn't been set so we don't fall through to the
next error hinting at running 'emerge --config' as well.
---
postgresql.init | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 1dabe2b..1575a11 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -30,6 +30,7 @@ checkconfig() {
if [ -z ${DATA_DIR} ] ; then
eerror "DATA_DIR not set"
eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
+ return 1
fi
if [ ! -d ${DATA_DIR} ] ; then
eerror "Directory not found: ${DATA_DIR}"
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-06-08 15:04 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-06-08 15:04 UTC (permalink / raw
To: gentoo-commits
commit: 430fd2285afb447359675bb6c1308162bf84212d
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun May 27 14:13:49 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun May 27 14:13:49 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=430fd228
Fixes b.g.o bug 407907. awk syntax fix for FreeBSD.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 1575a11..afef398 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -8,7 +8,7 @@ extra_started_commands="reload"
get_config() {
[ -f ${PGDATA}/postgresql.conf ] || return 1
- eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf | awk '$1 == "'$1'" { print $2 == "=" ? $3 : $2 }')
+ eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}
depend() {
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-06-08 15:04 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-06-08 15:04 UTC (permalink / raw
To: gentoo-commits
commit: 36a2cef1e4043345c4d33bd71bb905efbede7202
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun May 27 14:41:38 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun May 27 14:41:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=36a2cef1
More doubled slash prevention.
---
postgresql.init | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 6d27683..fd8368c 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -6,7 +6,7 @@
extra_started_commands="reload"
get_config() {
- [ -f ${PGDATA}/postgresql.conf ] || return 1
+ [ -f ${PGDATA%/}/postgresql.conf ] || return 1
eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}
@@ -75,7 +75,7 @@ start() {
ebegin "Starting PostgreSQL"
- rm -f ${DATA_DIR}/postmaster.pid
+ rm -f ${DATA_DIR%/}/postmaster.pid
local extraenv
local x
@@ -87,15 +87,15 @@ start() {
--user postgres \
--env "PGPORT=${configured_port}" \
${extraenv} \
- --pidfile ${DATA_DIR}/postmaster.pid \
+ --pidfile ${DATA_DIR%/}/postmaster.pid \
--exec /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
- -- start -s -w -t ${START_TIMEOUT} -l ${DATA_DIR}/postmaster.log \
+ -- start -s -w -t ${START_TIMEOUT} -l ${DATA_DIR%/}/postmaster.log \
-D ${PGDATA} -o "--data-directory=${DATA_DIR} ${PGOPTS}"
local retval=$?
if [ $retval -ne 0 ] ; then
eerror "Check the log for a possible explanation of the above error."
- eerror " ${DATA_DIR}/postmaster.log"
+ eerror " ${DATA_DIR%/}/postmaster.log"
eend $retval
return $retval
fi
@@ -124,13 +124,13 @@ stop() {
start-stop-daemon --stop \
--exec /usr/lib/postgresql-@SLOT@/bin/postgres \
--retry ${retries} \
- --pidfile ${DATA_DIR}/postmaster.pid
+ --pidfile ${DATA_DIR%/}/postmaster.pid
eend
}
reload() {
ebegin "Reloading PostgreSQL configuration"
- kill -HUP $(head -n1 ${DATA_DIR}/postmaster.pid)
+ kill -HUP $(head -n1 ${DATA_DIR%/}/postmaster.pid)
eend $?
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-06-08 15:04 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-06-08 15:04 UTC (permalink / raw
To: gentoo-commits
commit: 4f4d27dfb865f7285c746a4c8ec458dfddd82108
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun May 27 14:39:36 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun May 27 14:39:36 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=4f4d27df
More descriptive comments.
---
postgresql.init | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index afef398..6d27683 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -26,12 +26,14 @@ socket_path=$(get_config unix_socket_path)
: ${socket_path:=@RUNDIR@/run/postgresql}
checkconfig() {
- # Check that DATA_DIR has been set and exists
+ # Check that DATA_DIR has been set
if [ -z ${DATA_DIR} ] ; then
eerror "DATA_DIR not set"
eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@"
return 1
fi
+
+ # Check that DATA_DIR exists
if [ ! -d ${DATA_DIR} ] ; then
eerror "Directory not found: ${DATA_DIR}"
eerror "HINT: Ensure that DATA_DIR points to the right path."
@@ -40,7 +42,10 @@ checkconfig() {
return 1
fi
- # Check for the existence of PostgreSQL's config files.
+ # Check for the existence of PostgreSQL's config files, and set the
+ # proper mode and ownership.
+ # Only three files should be checked as potentially other files
+ # may be in PGDATA that should not be touched.
local file
for file in postgresql pg_hba pg_ident ; do
file="${PGDATA%/}/${file}.conf"
@@ -53,7 +58,8 @@ checkconfig() {
fi
done
- # Check the socket directory
+ # Set the proper permission for the socket path and create it if
+ # it doesn't exist.
checkpath -d -m 0770 -o postgres:postgres ${socket_path}
if [ -e ${socket_path%/}/.s.PGSQL.${configured_port} ] ; then
eerror "Socket conflict."
@@ -114,6 +120,7 @@ stop() {
retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
fi
+ # Loops through nice, rude, and force quite in one go.
start-stop-daemon --stop \
--exec /usr/lib/postgresql-@SLOT@/bin/postgres \
--retry ${retries} \
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-06-08 15:04 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-06-08 15:04 UTC (permalink / raw
To: gentoo-commits
commit: 89cdaf591cf5c1c538a44e8b8f584c4ce20aefe9
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun May 27 14:42:41 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun May 27 14:42:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=89cdaf59
Typo.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index fd8368c..9c6edae 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -120,7 +120,7 @@ stop() {
retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
fi
- # Loops through nice, rude, and force quite in one go.
+ # Loops through nice, rude, and force quit in one go.
start-stop-daemon --stop \
--exec /usr/lib/postgresql-@SLOT@/bin/postgres \
--retry ${retries} \
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-06-08 15:04 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-06-08 15:04 UTC (permalink / raw
To: gentoo-commits
commit: a61f1df6795497f3991ad6789675d3cff814e57b
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 8 15:03:06 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Fri Jun 8 15:03:06 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=a61f1df6
Actual parameter name. Fixes bug 418057.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 9c6edae..166ac71 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -22,7 +22,7 @@ depend() {
configured_port=$(get_config port)
: ${configured_port:=${PGPORT}}
-socket_path=$(get_config unix_socket_path)
+socket_path=$(get_config unix_socket_directory)
: ${socket_path:=@RUNDIR@/run/postgresql}
checkconfig() {
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2012-11-11 14:49 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2012-11-11 14:49 UTC (permalink / raw
To: gentoo-commits
commit: efabd1ffa0c9f597a25f77bf1763e0eb65537688
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 11 14:48:26 2012 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Nov 11 14:48:26 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=efabd1ff
Default to UTF-8 encoding
---
postgresql.confd | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.confd b/postgresql.confd
index b0e1308..96a2d9c 100644
--- a/postgresql.confd
+++ b/postgresql.confd
@@ -55,4 +55,4 @@ DATA_DIR="/var/lib/postgresql/@SLOT@/data"
# Additional options to pass to initdb.
# See `man initdb' for available options.
-#PG_INITDB_OPTS="--locale=en_US.UTF-8"
+PG_INITDB_OPTS="--encoding=UTF8"
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-01-19 20:50 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-01-19 20:50 UTC (permalink / raw
To: gentoo-commits
commit: 51b4446dd3cbd5f125a638c73756c10dc60eb4bc
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 19 20:50:20 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Jan 19 20:50:20 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=51b4446d
No need to restart because the logger did.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 166ac71..b1c0dfd 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -16,7 +16,7 @@ depend() {
provide postgresql
if [ "$(get_config log_destination)" = "syslog" ]; then
- need logger
+ use logger
fi
}
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-02-03 15:22 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-02-03 15:22 UTC (permalink / raw
To: gentoo-commits
commit: 639d295476a04b5f4a5a6b2b83b44e33774cc695
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 3 15:10:21 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Feb 3 15:10:21 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=639d2954
Wrap line
---
postgresql.init | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index b1c0dfd..b716d91 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -8,7 +8,8 @@ extra_started_commands="reload"
get_config() {
[ -f ${PGDATA%/}/postgresql.conf ] || return 1
- eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
+ eval echo $(sed -e 's:#.*::' ${PGDATA%/}/postgresql.conf \
+ | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}
depend() {
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-02-08 13:01 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-02-08 13:01 UTC (permalink / raw
To: gentoo-commits
commit: e6b34c0cf6655913044e1159315873ce77c4f9a4
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 8 13:00:58 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Fri Feb 8 13:00:58 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=e6b34c0c
Update copyright
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index b716d91..6af6471 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -1,5 +1,5 @@
#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-02-08 14:46 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-02-08 14:46 UTC (permalink / raw
To: gentoo-commits
commit: 4e68a4d7ec719548763beaa11d66699efc1fc47a
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 8 14:45:53 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Fri Feb 8 14:45:53 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=4e68a4d7
Just default to /run/postgresql.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 6af6471..9a1d64e 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -24,7 +24,7 @@ depend() {
configured_port=$(get_config port)
: ${configured_port:=${PGPORT}}
socket_path=$(get_config unix_socket_directory)
-: ${socket_path:=@RUNDIR@/run/postgresql}
+: ${socket_path:=/run/postgresql}
checkconfig() {
# Check that DATA_DIR has been set
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-03-09 15:01 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-03-09 15:01 UTC (permalink / raw
To: gentoo-commits
commit: c7b29a5071a1d7b86d40a56bb505cc8921d670ea
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 9 14:58:46 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Mar 9 14:58:46 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=c7b29a50
Change ${socket_path} permissions so that users in the `postgres'
system group cannot create, rename, or delete files in ${socket_path}.
---
postgresql.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 9a1d64e..aef9f04 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -61,7 +61,7 @@ checkconfig() {
# Set the proper permission for the socket path and create it if
# it doesn't exist.
- checkpath -d -m 0770 -o postgres:postgres ${socket_path}
+ checkpath -d -m 0750 -o postgres:postgres ${socket_path}
if [ -e ${socket_path%/}/.s.PGSQL.${configured_port} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-06-09 2:36 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-06-09 2:36 UTC (permalink / raw
To: gentoo-commits
commit: 06e4b096305332c0e0f9333d21e53b07d7a72a62
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 9 01:25:06 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Jun 9 01:25:06 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=06e4b096
Change security definition.
Move away from putting users into groups.
https://bugs.gentoo.org/show_bug.cgi?id=460956
---
postgresql.init | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index aef9f04..6e0e965 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -61,7 +61,7 @@ checkconfig() {
# Set the proper permission for the socket path and create it if
# it doesn't exist.
- checkpath -d -m 0750 -o postgres:postgres ${socket_path}
+ checkpath -d -m 0775 -o postgres:postgres ${socket_path}
if [ -e ${socket_path%/}/.s.PGSQL.${configured_port} ] ; then
eerror "Socket conflict."
eerror "A server is already listening on:"
@@ -95,8 +95,9 @@ start() {
local retval=$?
if [ $retval -ne 0 ] ; then
- eerror "Check the log for a possible explanation of the above error."
+ eerror "Check the log for a possible explanation of the above error. The log may be"
eerror " ${DATA_DIR%/}/postmaster.log"
+ eerror "Or wherever you configured PostgreSQL @SLOT@ log messages to be sent."
eend $retval
return $retval
fi
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-06-09 2:36 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-06-09 2:36 UTC (permalink / raw
To: gentoo-commits
commit: c396a16455a37644a77de10ac4f022410371c345
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 9 01:26:45 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Jun 9 01:26:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=c396a164
New systemd files
Add systemd unit
https://bugs.gentoo.org/show_bug.cgi?id=468868
---
postgresql.service | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
postgresql.tmpfilesd | 1 +
2 files changed, 52 insertions(+)
diff --git a/postgresql.service b/postgresql.service
new file mode 100644
index 0000000..3d70197
--- /dev/null
+++ b/postgresql.service
@@ -0,0 +1,51 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create file
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/*.conf"
+# containing your changes
+
+# For example, if you want to change the server's port number to 5433,
+# create a file named
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/port.conf"
+# containing:
+# [Service]
+# Environment=PGPORT=5433
+# This will override the setting appearing below.
+
+[Unit]
+Description=PostgreSQL database server
+After=network.target
+
+[Service]
+Type=forking
+
+User=postgres
+Group=postgres
+
+# Port number for server to listen on
+Environment=PGPORT=5432
+
+# Location of configuration files
+Environment=PGDATA=/etc/postgresql-@SLOT@
+
+# Where the data directory is located
+Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data
+
+# Where to send early-startup messages from the server (before the logging
+# options of postgresql.conf take effect)
+# This is normally controlled by the global default set by systemd
+# StandardOutput=syslog
+
+# Disable OOM kill on the postmaster
+OOMScoreAdjust=-1000
+
+#ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
+ExecStart=/usr/lib/postgresql-@SLOT@/bin/pg_ctl start -D ${PGDATA} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} --data-directory=${DATA_DIR}" -w -t 300
+ExecStop=/usr/lib/postgresql-@SLOT@/bin/pg_ctl stop -D ${PGDATA} -s -m fast -o "--data-directory=${DATA_DIR}"
+ExecReload=/usr/lib/postgresql-@SLOT@/bin/pg_ctl reload -D ${PGDATA} -s -o "--data-directory=${DATA_DIR}"
+
+# Give a reasonable amount of time for the server to start up/shut down
+TimeoutSec=300
+
+[Install]
+WantedBy=multi-user.target
diff --git a/postgresql.tmpfilesd b/postgresql.tmpfilesd
new file mode 100644
index 0000000..c2e0747
--- /dev/null
+++ b/postgresql.tmpfilesd
@@ -0,0 +1 @@
+d /run/postgresql 0775 postgres postgres -
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2013-08-21 0:59 Aaron Swenson
0 siblings, 0 replies; 35+ messages in thread
From: Aaron Swenson @ 2013-08-21 0:59 UTC (permalink / raw
To: gentoo-commits
commit: dbf7529b88ea447dbfed0bf3f1a9c7627e6285af
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 21 00:59:16 2013 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Wed Aug 21 00:59:16 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=dbf7529b
Updated systemd files.
---
postgresql-check-db-dir | 36 ++++++++++++++++++++++++++++++++++++
postgresql.service | 14 +++++++-------
2 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/postgresql-check-db-dir b/postgresql-check-db-dir
new file mode 100644
index 0000000..d4e1083
--- /dev/null
+++ b/postgresql-check-db-dir
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+eerror() {
+ echo "$@" >&2
+}
+
+# Check that DATA_DIR has been set
+if [ -z ${DATA_DIR} ] ; then
+ eerror "DATA_DIR not set"
+ exit 1
+fi
+
+# Check that DATA_DIR exists
+if [ ! -d ${DATA_DIR} ] ; then
+ eerror "Directory not found: ${DATA_DIR}"
+ eerror "HINT: Ensure that DATA_DIR points to the right path."
+ eerror "HINT: Or perhaps you need to create the database cluster:"
+ eerror " emerge --config dev-db/postgresql-server:@SLOT@"
+ exit 1
+fi
+
+# Check for the existence of PostgreSQL's config files, and set the
+# proper mode and ownership.
+# Only three files should be checked as potentially other files
+# may be in PGDATA that should not be touched.
+for file in postgresql pg_hba pg_ident ; do
+ file="${PGDATA%/}/${file}.conf"
+ if [ ! -f ${file} ] ; then
+ eerror "${file} not found"
+ eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}"
+ exit 1
+ fi
+done
diff --git a/postgresql.service b/postgresql.service
index 3d70197..f8be8ac 100644
--- a/postgresql.service
+++ b/postgresql.service
@@ -36,16 +36,16 @@ Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog
-# Disable OOM kill on the postmaster
-OOMScoreAdjust=-1000
-
-#ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
-ExecStart=/usr/lib/postgresql-@SLOT@/bin/pg_ctl start -D ${PGDATA} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} --data-directory=${DATA_DIR}" -w -t 300
-ExecStop=/usr/lib/postgresql-@SLOT@/bin/pg_ctl stop -D ${PGDATA} -s -m fast -o "--data-directory=${DATA_DIR}"
-ExecReload=/usr/lib/postgresql-@SLOT@/bin/pg_ctl reload -D ${PGDATA} -s -o "--data-directory=${DATA_DIR}"
+ExecStartPre=/usr/bin/postgresql-@SLOT@-check-db-dir
+ExecStart=/usr/lib/postgresql-@SLOT@/bin/pg_ctl start -D ${DATA_DIR} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} -D ${PGDATA} --data-directory=${DATA_DIR}" -w -t 300
+ExecStop=/usr/lib/postgresql-@SLOT@/bin/pg_ctl stop -D ${DATA_DIR} -s -m fast
+ExecReload=/usr/lib/postgresql-@SLOT@/bin/pg_ctl reload -D ${DATA_DIR} -s
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
+# Disable OOM kill on the postmaster
+OOMScoreAdjust=-1000
+
[Install]
WantedBy=multi-user.target
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [gentoo-commits] proj/pgsql-patches:initscripts commit in: /
@ 2014-04-23 1:52 Mike Gilbert
0 siblings, 0 replies; 35+ messages in thread
From: Mike Gilbert @ 2014-04-23 1:52 UTC (permalink / raw
To: gentoo-commits
commit: 1df0c1913e44666192bdde8285c3e7e09ebff84b
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 28 03:35:29 2013 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 03:35:29 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=1df0c191
Replace /usr/lib with /usr/@LIBDIR@
---
postgresql.init | 4 ++--
postgresql.service | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/postgresql.init b/postgresql.init
index 6e0e965..413558e 100755
--- a/postgresql.init
+++ b/postgresql.init
@@ -89,7 +89,7 @@ start() {
--env "PGPORT=${configured_port}" \
${extraenv} \
--pidfile ${DATA_DIR%/}/postmaster.pid \
- --exec /usr/lib/postgresql-@SLOT@/bin/pg_ctl \
+ --exec /usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl \
-- start -s -w -t ${START_TIMEOUT} -l ${DATA_DIR%/}/postmaster.log \
-D ${PGDATA} -o "--data-directory=${DATA_DIR} ${PGOPTS}"
local retval=$?
@@ -124,7 +124,7 @@ stop() {
# Loops through nice, rude, and force quit in one go.
start-stop-daemon --stop \
- --exec /usr/lib/postgresql-@SLOT@/bin/postgres \
+ --exec /usr/@LIBDIR@/postgresql-@SLOT@/bin/postgres \
--retry ${retries} \
--pidfile ${DATA_DIR%/}/postmaster.pid
diff --git a/postgresql.service b/postgresql.service
index f8be8ac..20ed27a 100644
--- a/postgresql.service
+++ b/postgresql.service
@@ -37,9 +37,9 @@ Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data
# StandardOutput=syslog
ExecStartPre=/usr/bin/postgresql-@SLOT@-check-db-dir
-ExecStart=/usr/lib/postgresql-@SLOT@/bin/pg_ctl start -D ${DATA_DIR} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} -D ${PGDATA} --data-directory=${DATA_DIR}" -w -t 300
-ExecStop=/usr/lib/postgresql-@SLOT@/bin/pg_ctl stop -D ${DATA_DIR} -s -m fast
-ExecReload=/usr/lib/postgresql-@SLOT@/bin/pg_ctl reload -D ${DATA_DIR} -s
+ExecStart=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl start -D ${DATA_DIR} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} -D ${PGDATA} --data-directory=${DATA_DIR}" -w -t 300
+ExecStop=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl stop -D ${DATA_DIR} -s -m fast
+ExecReload=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl reload -D ${DATA_DIR} -s
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
^ permalink raw reply related [flat|nested] 35+ messages in thread
end of thread, other threads:[~2014-04-23 1:52 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21 0:59 [gentoo-commits] proj/pgsql-patches:initscripts commit in: / Aaron Swenson
-- strict thread matches above, loose matches on Subject: below --
2014-04-23 1:52 Mike Gilbert
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 1:36 Aaron Swenson
2011-03-20 0:39 Aaron Swenson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox