]> git.pld-linux.org Git - packages/postgresql.git/blob - postgresql.init
Standarized all rc scripts.
[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 [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0
26
27 # Sanity check
28 [ -f /tmp/.s.PGSQL.5432 ] || rm -f /tmp/.s.PGSQL.5432
29
30
31 # See how we were called.
32 case "$1" in
33   start)
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
45         touch /var/lock/subsys/postgresql
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         ;;
57   restart|reload)
58         $0 stop
59         $0 start
60         ;;
61   *)
62         echo "Usage: postgresql {start|stop|status|restart|reload}"
63         exit 1
64 esac
65
66 exit 0
This page took 0.061288 seconds and 3 git commands to generate.