Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 58f882d

Browse files
committed
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
1 parent c9ecf3d commit 58f882d

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

contrib/init.d/postgresql

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,65 @@
11
#! /bin/sh
22
#
3-
# PostgreSQL Start the pgsql RDMBS.
3+
# PostgreSQL Start, stop, and get status on the PostgreSQL RDMBS.
4+
# This script is Linux distribution independent
5+
# (or at least should be :).
6+
#
7+
# By Ryan Kirkpatrick <pgsql@rkirkpat.net>.
8+
#
9+
# If you find any problems with this script, or have suggestions
10+
# please send them to me.
11+
12+
# Arguements for pg_ctl and then for the postmaster. Change as needed.
13+
ARGS="-w -D /home/postgres/data"
14+
PM_ARGS="-i -F"
15+
16+
# Changes should not be needed beyond this point.
417

18+
# The path that is to be used for the script.
519
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
20+
21+
# What to use to start up the postmster, and a few names.
622
DAEMON=/home/postgres/bin/pg_ctl
723
NAME=postmaster
824
FILE=postgresql
9-
ARGS="-w -D /home/postgres/data -o -i -o -F"
10-
USER="postgres:postgres"
11-
LOG="/home/postgres/server.log"
1225
DESC="PostgreSQL RDBMS"
1326

14-
test -f $DAEMON || exit 0
27+
# Who to run pg_ctl as, should be postgres.
28+
USER="postgres:postgres"
1529

30+
# Where to keep a log file.
31+
LOG="/usr/local/pgsql/server.log"
32+
33+
# Only start if we can find pg_ctl.
34+
test -f $DAEMON || exit 0
1635
set -e
1736

37+
# Parse command line parameters.
1838
case "$1" in
1939
start)
40+
# Start the postmaster using pg_ctl and given options.
2041
echo -n "Starting $DESC: "
21-
su - postgres sh -c "$DAEMON start $ARGS >& $LOG"
42+
su - postgres sh -c "$DAEMON start $ARGS -o \"$PM_ARGS\" >& $LOG"
2243
echo "$NAME."
2344
;;
2445
stop)
46+
# Stop the postmaster using pg_ctl.
2547
echo -n "Stopping $DESC: "
2648
su - postgres sh -c "$DAEMON stop >& /dev/null"
2749
echo "$NAME."
2850
;;
2951
restart)
52+
# Restart the postmaster by calling ourselves.
3053
/etc/init.d/$FILE stop
3154
sleep 5
3255
/etc/init.d/$FILE start
3356
;;
3457
status)
58+
# Print the status of the postmaster.
3559
su - postgres $DAEMON status
3660
;;
3761
*)
62+
# Print help.
3863
N=/etc/init.d/$FILE
3964
echo "Usage: $N {start|stop|restart|status}" >&2
4065
exit 1

0 commit comments

Comments
 (0)