3 # postgresql This is the init script for starting up the PostgreSQL
8 # description: Starts and stops the PostgreSQL backend daemon that handles \
9 # all database requests.
11 # processname: postmaster
12 # pidfile: /var/run/postmaster.pid
14 # Source function library
15 . /etc/rc.d/init.d/functions
18 . /etc/sysconfig/network
21 if [ -f /etc/sysconfig/postgresql ] ; then
22 . /etc/sysconfig/postgresql
24 ALLOW_TCP_CONNECTIONS=no
25 POSTGRES_DATA_DIR=/var/state/psql
28 # Check that networking is up.
29 if [ "${NETWORKING}" = "no" ]; then
30 echo "WARNING: Networking is down. Postgresql service can't be runed."
35 [ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
37 # See how we were called.
40 # Check if the service is already running?
41 if [ ! -f /var/lock/subsys/postgresql ]; then
42 show Starting postgresql
44 su postgres -c "/usr/bin/postmaster \
45 $([ "$ALLOW_TCP_CONNECTIONS" = yes ] && echo "-i") \
46 $([ -n "$MAX_NUM_BACKENDS" ] && echo "-N $MAX_NUM_BACKENDS") \
47 $([ -n "$POSTGRES_DATA_DIR" ] && echo "-D $POSTGRES_DATA_DIR") \
49 $([ "$POSTGRES_QUIET" = yes ] && echo "-Q") \
50 $([ "$POSTGRES_DIABLE_FSYNC" = yes ] && echo "-F") \
52 if ps ax | grep -v grep | grep -q postmaster; then
58 echo "Postgresql already is running"
60 touch /var/lock/subsys/postgresql
63 show Stopping postgresql service
66 rm -f /var/run/postmaster.pid
67 rm -f /var/lock/subsys/postgresql
77 echo "Usage: postgresql {start|stop|status|restart|reload}"