diff options
author | Adis Nezirovic <adis_at_linux.org.ba> | 2013-10-26 00:40:32 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2013-10-27 23:38:51 -0500 |
commit | b81b97324fb0fd50f5a9e29c974c25744a7f1e2d (patch) | |
tree | a29383f2e861b9a67efcb670c8c72fd9832425fd /system/postgresql/rc.postgresql.new | |
parent | 319f898b5f28a560edd68c09dcc7c8facecf0280 (diff) |
system/postgresql: Updated for version 9.3.0.
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/postgresql/rc.postgresql.new')
-rw-r--r-- | system/postgresql/rc.postgresql.new | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/system/postgresql/rc.postgresql.new b/system/postgresql/rc.postgresql.new index 6ccda6a3355e9..7e984c6582058 100644 --- a/system/postgresql/rc.postgresql.new +++ b/system/postgresql/rc.postgresql.new @@ -1,8 +1,9 @@ #!/bin/bash -# PostgreSQL startup script for Slackware Linux -# Copyright 2007 Adis Nezirovic <adis _at_ linux.org.ba> -# Licensed under GNU GPL v2 +## PostgreSQL startup script for Slackware Linux +## +## Copyright (c) 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba> +## Licensed under GNU GPL v2 # Do not source this script (since it contains exit() calls) @@ -10,12 +11,32 @@ # database files in /var/lib/pgsql. The following should do # the trick. # -# $ su postgres -c "initdb -D /var/lib/pgsql/data" +# $ su postgres -c "initdb -D /var/lib/pgsql/@PG_VERSION@/data" # -LOGFILE=/var/log/postgresql -DATADIR=/var/lib/pgsql/data -POSTGRES=/usr/bin/postgres +# Since PostgreSQL 9.3 this startup script can run multiple PostgreSQL +# versions on different ports and with different data dirs. +# +# e.g. PG_VERSION=9.4 PG_PORT=6432 /etc/rc.d/rc.postgresql start +# +# Older PostgreSQL 9.x versions are supported too, just use PG_VERSION=9.2 + +PG_VERSION=${PG_VERSION:-@PG_VERSION@} +PG_PORT=${PG_PORT:-@PG_PORT@} +LIBDIRSUFFIX="@LIBDIRSUFFIX@" + +if [ "x$PG_VERSION" != "x9.2" ];then + LOGFILE=/var/log/postgresql-$PG_VERSION + DATADIR=/var/lib/pgsql/$PG_VERSION/data + POSTGRES=/usr/lib${LIBDIRSUFFIX}/postgresql/$PG_VERSION/bin/postgres + PG_CTL=/usr/lib${LIBDIRSUFFIX}/postgresql/$PG_VERSION/bin/pg_ctl +else + LOGFILE=/var/log/postgresql + DATADIR=/var/lib/pgsql/data + POSTGRES=/usr/bin/postgres + PG_CTL=/usr/bin/pg_ctl +fi + PIDFILE=postmaster.pid # oom-killer score @@ -38,7 +59,7 @@ OOM_SCORE_ADJ=-1000 pg_ctl() { - CMD="/usr/bin/pg_ctl $@" + CMD="$PG_CTL -o '-p $PG_PORT' $@" su - postgres -c "$CMD" } @@ -71,8 +92,8 @@ case "$1" in else # remove old socket, if it exists and no daemon is running. if [ ! -f $DATADIR/$PIDFILE ]; then - rm -f /tmp/.s.PGSQL.5432 - rm -f /tmp/.s.PGSQL.5432.lock + rm -f /tmp/.s.PGSQL.$PG_PORT + rm -f /tmp/.s.PGSQL.$PG_PORT.lock test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj pg_ctl start -w -l $LOGFILE -D $DATADIR exit 0 |