]> git.pld-linux.org Git - packages/postgresql.git/blob - postgresql.init
- fix in checking is netforking is up.
[packages/postgresql.git] / postgresql.init
1 #!/bin/sh
2 #
3 # postgresql    This is the init script for starting up the PostgreSQL
4 #               server
5 #
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
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Get service config
22 [ -f /etc/sysconfig/postgresql ] && . /etc/sysconfig/postgresql
23
24 # Check that networking is up.
25 if [ "${NETWORKING}" = "no" ]; then
26         echo "WARNING: Networking is down. Postgresql service can't be runed."
27         exit 1
28 fi
29
30 # Sanity check
31 [ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
32
33
34 # See how we were called.
35 case "$1" in
36   start)
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
48         touch /var/lock/subsys/postgresql
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         ;;
60   restart|reload)
61         $0 stop
62         $0 start
63         ;;
64   *)
65         echo "Usage: postgresql {start|stop|status|restart|reload}"
66         exit 1
67 esac
68
69 exit 0
This page took 0.037699 seconds and 4 git commands to generate.