]> git.pld-linux.org Git - packages/postgresql.git/blame - postgresql.init
- fix in checking is netforking is up.
[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.
d584f4fd 25if [ "${NETWORKING}" = "no" ]; then
26 echo "WARNING: Networking is down. Postgresql service can't be runed."
27 exit 1
28fi
d29ea5e3 29
c35cc882 30# Sanity check
d29ea5e3 31[ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
32
d29ea5e3 33
34# See how we were called.
35case "$1" in
36 start)
c35cc882 37 # Check if the service is already running?
38 if [ ! -f /var/lock/subsys/postgresql ]; then
39 show Starting postgresql
40 busy
41 su postgres -c '/usr/bin/postmaster
42 touch /var/lock/subsys/postgresql
43 deltext
44 ok
45 else
46 echo "Postgresql already is running"
47 fi
d29ea5e3 48 touch /var/lock/subsys/postgresql
d29ea5e3 49 ;;
50 stop)
51 show Stopping postgresql service
52 killproc postmaster
53 sleep 2
54 rm -f /var/run/postmaster.pid
55 rm -f /var/lock/subsys/postgresql
56 ;;
57 status)
58 status postmaster
59 ;;
c35cc882 60 restart|reload)
d29ea5e3 61 $0 stop
62 $0 start
63 ;;
64 *)
c35cc882 65 echo "Usage: postgresql {start|stop|status|restart|reload}"
d29ea5e3 66 exit 1
67esac
68
69exit 0
This page took 0.032442 seconds and 4 git commands to generate.