]> git.pld-linux.org Git - packages/pound.git/blob - pound.init
- multiple instance support
[packages/pound.git] / pound.init
1 #!/bin/sh
2 #
3 # pound
4 #
5 # chkconfig:    345 85 15
6 # description:  reverse-proxy and load-balancer
7 #
8
9 # Source function library
10 . /etc/rc.d/init.d/functions
11
12 # Get network config
13 . /etc/sysconfig/network
14
15 # List of instances to start.
16 POUND_INSTANCES="pound"
17
18 # Get service config
19 [ -f /etc/sysconfig/pound ] && . /etc/sysconfig/pound
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24                 msg_network_down pound
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 start() {
32         for instance in $POUND_INSTANCES; do
33                 # Check if the service is already running?
34                 if [ ! -f /var/lock/subsys/pound-$instance ]; then
35                         msg_starting "Pound ($instance)"
36                         daemon pound -f /etc/pound/$instance.cfg -p /var/run/pound/$instance.pid
37                         RETVAL=$?
38                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pound-$instance
39                 else
40                         msg_already_running "Pound ($instance)"
41                 fi
42         done
43 }
44
45 stop() {
46         # Stop daemons.
47         for instance in $POUND_INSTANCES; do
48                 if [ -f /var/lock/subsys/pound-$instance ]; then
49                         msg_stopping "Pound ($instance)"
50                         killproc --pidfile pound/$instance.pid pound 
51                         rm -f /var/lock/subsys/pound-$instance > /dev/null 2>&1
52                 else
53                         msg_not_running "Pound ($instance)"
54                 fi
55         done
56 }
57
58 RETVAL=0
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   stop)
65         stop
66         ;;
67   status)
68         status pound
69         exit $?
70         ;;
71   restart|force-reload)
72         stop
73         start
74         ;;
75   *)
76         msg_usage "$0 {start|stop|restart|force-reload|status}"
77         exit 3
78 esac
79
80 exit $RETVAL
This page took 0.071083 seconds and 4 git commands to generate.