]> git.pld-linux.org Git - packages/postgresql.git/blame - postgresql.init
- removed initdb from spec (add to postgresql.init)
[packages/postgresql.git] / postgresql.init
CommitLineData
c35cc882 1#!/bin/sh
2#
d29ea5e3 3# postgresql This is the init script for starting up the PostgreSQL
4# server
5#
c35cc882 6# chkconfig: 345 85 15
7#
8# description: Starts and stops the PostgreSQL backend daemon that handles \
9# all database requests.
10#
11# processname: postmaster
12# pidfile: /var/run/postmaster.pid
13
c35cc882 14# Source function library
d29ea5e3 15. /etc/rc.d/init.d/functions
16
c35cc882 17# Get network config
d29ea5e3 18. /etc/sysconfig/network
19
c35cc882 20# Get service config
b57548c1 21if [ -f /etc/sysconfig/postgresql ] ; then
22 . /etc/sysconfig/postgresql
03af0381 23else
b57548c1 24 ALLOW_TCP_CONNECTIONS=no
25 POSTGRES_DATA_DIR=/var/state/psql
03af0381 26fi
27
c35cc882 28# Check that networking is up.
d584f4fd 29if [ "${NETWORKING}" = "no" ]; then
30 echo "WARNING: Networking is down. Postgresql service can't be runed."
31 exit 1
32fi
d29ea5e3 33
c35cc882 34# Sanity check
d29ea5e3 35[ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
36
d29ea5e3 37# See how we were called.
38case "$1" in
39 start)
c35cc882 40 # Check if the service is already running?
41 if [ ! -f /var/lock/subsys/postgresql ]; then
42 show Starting postgresql
43 busy
9d56d95e 44 su postgres -c "/usr/bin/postmaster \
b57548c1 45 $([ "$ALLOW_TCP_CONNECTIONS" = yes ] && echo "-i") \
9d56d95e 46 $([ -n "$MAX_NUM_BACKENDS" ] && echo "-N $MAX_NUM_BACKENDS") \
d5443eaf 47 $([ -n "POSTGRES_$DATA_DIR" ] && echo "-D $POSTGRES_DATA_DIR") \
9d56d95e 48 -o \
49 $([ "$POSTGRES_QUIET" = yes ] && echo "-Q") \
5688d89f 50 $([ "$POSTGRES_DIABLE_FSYNC" = yes ] && echo "-F") &"
d5443eaf 51 sleep 2
70825085 52 if ps ax | grep -v grep | grep -q postmaster; then
9d56d95e 53 deltext;ok
70825085 54 else
9d56d95e 55 deltext;fail
70825085 56 fi
c35cc882 57 else
58 echo "Postgresql already is running"
59 fi
d29ea5e3 60 touch /var/lock/subsys/postgresql
d29ea5e3 61 ;;
62 stop)
63 show Stopping postgresql service
64 killproc postmaster
65 sleep 2
66 rm -f /var/run/postmaster.pid
67 rm -f /var/lock/subsys/postgresql
68 ;;
69 status)
70 status postmaster
71 ;;
c35cc882 72 restart|reload)
d29ea5e3 73 $0 stop
74 $0 start
75 ;;
76 *)
c35cc882 77 echo "Usage: postgresql {start|stop|status|restart|reload}"
d29ea5e3 78 exit 1
79esac
80
81exit 0
This page took 0.563315 seconds and 4 git commands to generate.