]> git.pld-linux.org Git - packages/postgresql.git/blame - postgresql.init
Standarized all rc scripts.
[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
14
15# Source function library
d29ea5e3 16. /etc/rc.d/init.d/functions
17
c35cc882 18# Get network config
d29ea5e3 19. /etc/sysconfig/network
20
c35cc882 21# Get service config
22[ -f /etc/sysconfig/postgresql ] && . /etc/sysconfig/postgresql
d29ea5e3 23
c35cc882 24# Check that networking is up.
25[ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0
d29ea5e3 26
c35cc882 27# Sanity check
d29ea5e3 28[ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
29
d29ea5e3 30
31# See how we were called.
32case "$1" in
33 start)
c35cc882 34 # Check if the service is already running?
35 if [ ! -f /var/lock/subsys/postgresql ]; then
36 show Starting postgresql
37 busy
38 su postgres -c '/usr/bin/postmaster
39 touch /var/lock/subsys/postgresql
40 deltext
41 ok
42 else
43 echo "Postgresql already is running"
44 fi
d29ea5e3 45 touch /var/lock/subsys/postgresql
d29ea5e3 46 ;;
47 stop)
48 show Stopping postgresql service
49 killproc postmaster
50 sleep 2
51 rm -f /var/run/postmaster.pid
52 rm -f /var/lock/subsys/postgresql
53 ;;
54 status)
55 status postmaster
56 ;;
c35cc882 57 restart|reload)
d29ea5e3 58 $0 stop
59 $0 start
60 ;;
61 *)
c35cc882 62 echo "Usage: postgresql {start|stop|status|restart|reload}"
d29ea5e3 63 exit 1
64esac
65
66exit 0
This page took 0.072969 seconds and 4 git commands to generate.