aboutsummaryrefslogtreecommitdiff
path: root/system/postgresql/rc.postgresql.new
diff options
context:
space:
mode:
authorAdis Nezirovic <adis_at_linux.org.ba>2014-01-06 18:19:29 +0100
committerErik Hanson <erik@slackbuilds.org>2014-01-07 11:13:07 -0600
commit4911bc963f072a216abb4b9c15cfba679e6795b7 (patch)
tree62eac071981816f072f0bc171c3da1725fa90d50 /system/postgresql/rc.postgresql.new
parent11a427aed5293863f0798045ba9fd9ac57da246c (diff)
system/postgresql: Updated for version 9.3.2.
More sensible defaults for database encoding and auth Misc cleanups Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'system/postgresql/rc.postgresql.new')
-rw-r--r--system/postgresql/rc.postgresql.new48
1 files changed, 19 insertions, 29 deletions
diff --git a/system/postgresql/rc.postgresql.new b/system/postgresql/rc.postgresql.new
index 7e984c658205..a505e69572f2 100644
--- a/system/postgresql/rc.postgresql.new
+++ b/system/postgresql/rc.postgresql.new
@@ -2,42 +2,31 @@
## PostgreSQL startup script for Slackware Linux
##
-## Copyright (c) 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba>
+## Copyright (c) 2007-2014 Adis Nezirovic <adis _at_ linux.org.ba>
## Licensed under GNU GPL v2
# Do not source this script (since it contains exit() calls)
-# Before you can run postgresql you'll need to create the
+# Before you can run PostgreSQL you'll need to create the
# database files in /var/lib/pgsql. The following should do
# the trick.
#
-# $ su postgres -c "initdb -D /var/lib/pgsql/@PG_VERSION@/data"
+# $ su postgres -c "initdb -D /var/lib/pgsql/@PG_VERSION@/data -E utf-8 -A md5 -W"
#
-# Since PostgreSQL 9.3 this startup script can run multiple PostgreSQL
+# Since version 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
+# e.g. PG_VERSION=9.4 PG_PORT=6432 /etc/rc.d/rc.@PRGNAM@ start
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
+LOGFILE=/var/log/@PRGNAM@-$PG_VERSION
+DATADIR=/var/lib/pgsql/$PG_VERSION/data
+POSTGRES=/usr/lib${LIBDIRSUFFIX}/@PRGNAM@/$PG_VERSION/bin/postgres
+PG_CTL=/usr/lib${LIBDIRSUFFIX}/@PRGNAM@/$PG_VERSION/bin/pg_ctl
+PIDFILE=$DATADIR/postmaster.pid
# oom-killer score
# if defined and set to -1000, main postmaster wont be killed
@@ -78,20 +67,21 @@ case "$1" in
if [ ! -e $DATADIR/PG_VERSION ]; then
echo "You should initialize the PostgreSQL database at location $DATADIR"
+ echo "e.g. su postgres -c \"initdb -D $DATADIR -E utf-8 -A md5 -W\""
exit 6
fi
if [ $(pgrep -f $POSTGRES) ]; then
echo "PostgreSQL daemon already running"
- if [ ! -f $DATADIR/$PIDFILE ]; then
- echo "Warning: Missing pid file $DATADIR/$PIDFILE"
+ if [ ! -f $PIDFILE ]; then
+ echo "Warning: Missing pid file $PIDFILE"
fi
exit 1
else # remove old socket, if it exists and no daemon is running.
- if [ ! -f $DATADIR/$PIDFILE ]; then
+ if [ ! -f $PIDFILE ]; then
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
@@ -99,7 +89,7 @@ case "$1" in
exit 0
else
echo "PostgreSQL daemon was not properly shut down"
- echo "Please remove stale pid file $DATADIR/$PIDFILE"
+ echo "Please remove stale pid file $PIDFILE"
exit 7
fi
@@ -154,16 +144,16 @@ case "$1" in
if [ $(pgrep -f $POSTGRES) ]; then
echo "PostgreSQL is running"
- if [ ! -e $DATADIR/$PIDFILE ]; then
- echo "Warning: Missing pid file $DATADIR/$PIDFILE"
+ if [ ! -e $PIDFILE ]; then
+ echo "Warning: Missing pid file $PIDFILE"
fi
exit 0
else
echo "PostgreSQL is stopped"
- if [ -e $DATADIR/$PIDFILE ]; then
- echo "Detected stale pid file $DATADIR/$PIDFILE"
+ if [ -e $PIDFILE ]; then
+ echo "Detected stale pid file $PIDFILE"
fi
exit 0