Please replace with the one attached to this email message. The
previous version depended on the below patch, this one does not. It is also a bit cleaner and has a few more helpful comments. Ryan Kirkpatrick
This commit is contained in:
parent
c9ecf3d1f1
commit
58f882d4b2
@ -1,40 +1,65 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
#
|
#
|
||||||
# PostgreSQL Start the pgsql RDMBS.
|
# PostgreSQL Start, stop, and get status on the PostgreSQL RDMBS.
|
||||||
|
# This script is Linux distribution independent
|
||||||
|
# (or at least should be :).
|
||||||
|
#
|
||||||
|
# By Ryan Kirkpatrick <pgsql@rkirkpat.net>.
|
||||||
|
#
|
||||||
|
# If you find any problems with this script, or have suggestions
|
||||||
|
# please send them to me.
|
||||||
|
|
||||||
|
# Arguements for pg_ctl and then for the postmaster. Change as needed.
|
||||||
|
ARGS="-w -D /home/postgres/data"
|
||||||
|
PM_ARGS="-i -F"
|
||||||
|
|
||||||
|
# Changes should not be needed beyond this point.
|
||||||
|
|
||||||
|
# The path that is to be used for the script.
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
|
# What to use to start up the postmster, and a few names.
|
||||||
DAEMON=/home/postgres/bin/pg_ctl
|
DAEMON=/home/postgres/bin/pg_ctl
|
||||||
NAME=postmaster
|
NAME=postmaster
|
||||||
FILE=postgresql
|
FILE=postgresql
|
||||||
ARGS="-w -D /home/postgres/data -o -i -o -F"
|
|
||||||
USER="postgres:postgres"
|
|
||||||
LOG="/home/postgres/server.log"
|
|
||||||
DESC="PostgreSQL RDBMS"
|
DESC="PostgreSQL RDBMS"
|
||||||
|
|
||||||
test -f $DAEMON || exit 0
|
# Who to run pg_ctl as, should be postgres.
|
||||||
|
USER="postgres:postgres"
|
||||||
|
|
||||||
|
# Where to keep a log file.
|
||||||
|
LOG="/usr/local/pgsql/server.log"
|
||||||
|
|
||||||
|
# Only start if we can find pg_ctl.
|
||||||
|
test -f $DAEMON || exit 0
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Parse command line parameters.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
# Start the postmaster using pg_ctl and given options.
|
||||||
echo -n "Starting $DESC: "
|
echo -n "Starting $DESC: "
|
||||||
su - postgres sh -c "$DAEMON start $ARGS >& $LOG"
|
su - postgres sh -c "$DAEMON start $ARGS -o \"$PM_ARGS\" >& $LOG"
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
# Stop the postmaster using pg_ctl.
|
||||||
echo -n "Stopping $DESC: "
|
echo -n "Stopping $DESC: "
|
||||||
su - postgres sh -c "$DAEMON stop >& /dev/null"
|
su - postgres sh -c "$DAEMON stop >& /dev/null"
|
||||||
echo "$NAME."
|
echo "$NAME."
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
|
# Restart the postmaster by calling ourselves.
|
||||||
/etc/init.d/$FILE stop
|
/etc/init.d/$FILE stop
|
||||||
sleep 5
|
sleep 5
|
||||||
/etc/init.d/$FILE start
|
/etc/init.d/$FILE start
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
|
# Print the status of the postmaster.
|
||||||
su - postgres $DAEMON status
|
su - postgres $DAEMON status
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
# Print help.
|
||||||
N=/etc/init.d/$FILE
|
N=/etc/init.d/$FILE
|
||||||
echo "Usage: $N {start|stop|restart|status}" >&2
|
echo "Usage: $N {start|stop|restart|status}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user