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/syslog ] ; then
22 . /etc/sysconfig/syslog
27 if [ "$ALLOW_TCP" = yes ]; then
34 # Check that networking is up.
35 if [ "${NETWORKING}" = "no" ]; then
36 echo "WARNING: Networking is down. Postgresql service can't be runed."
41 [ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
43 # See how we were called.
46 # Check if the service is already running?
47 if [ ! -f /var/lock/subsys/postgresql ]; then
48 show Starting postgresql
50 su postgres -c "/usr/bin/postmaster $ALLOW_TCP $OPTIONS -D /var/state/pgsql" &
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}"