diff options
author | Aaron W. Swenson <titanofold@gentoo.org> | 2011-03-19 21:34:34 -0400 |
---|---|---|
committer | Aaron W. Swenson <titanofold@gentoo.org> | 2011-03-19 21:34:34 -0400 |
commit | a43d11fff0d6eaded238d7c3c58689df3f73cee2 (patch) | |
tree | 8e243802ff40ca0e924ac4642ebfb112ba7e49ca /postgresql.init | |
parent | Initial commit of initscript and related conf file for 8.2. (diff) | |
download | patches-a43d11fff0d6eaded238d7c3c58689df3f73cee2.tar.gz patches-a43d11fff0d6eaded238d7c3c58689df3f73cee2.tar.bz2 patches-a43d11fff0d6eaded238d7c3c58689df3f73cee2.zip |
Initscript and related conf for 8.3+.
Diffstat (limited to 'postgresql.init')
-rw-r--r-- | postgresql.init | 37 |
1 files changed, 20 insertions, 17 deletions
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 $? } |