]>
Commit | Line | Data |
---|---|---|
59f6c21a | 1 | #!/bin/sh |
2 | # | |
7dbb2b59 | 3 | # pound |
59f6c21a | 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 | ||
f33820c6 ER |
15 | # List of instances to start. |
16 | POUND_INSTANCES="pound" | |
17 | ||
59f6c21a | 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 | |
1a0ae1a4 | 23 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
74738d13 | 24 | msg_network_down pound |
25 | exit 1 | |
26 | fi | |
59f6c21a | 27 | else |
74738d13 | 28 | exit 0 |
59f6c21a | 29 | fi |
30 | ||
50de9853 | 31 | start() { |
f33820c6 ER |
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 | |
50de9853 ER |
43 | } |
44 | ||
45 | stop() { | |
74738d13 | 46 | # Stop daemons. |
f33820c6 ER |
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 | |
50de9853 ER |
56 | } |
57 | ||
58 | RETVAL=0 | |
59 | # See how we were called. | |
60 | case "$1" in | |
61 | start) | |
62 | start | |
63 | ;; | |
64 | stop) | |
65 | stop | |
59f6c21a | 66 | ;; |
67 | status) | |
68 | status pound | |
5917fcaf | 69 | exit $? |
59f6c21a | 70 | ;; |
5917fcaf | 71 | restart|force-reload) |
50de9853 ER |
72 | stop |
73 | start | |
59f6c21a | 74 | ;; |
75 | *) | |
5917fcaf | 76 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
77 | exit 3 | |
59f6c21a | 78 | esac |
79 | ||
80 | exit $RETVAL |