6 # description: reverse-proxy and load-balancer
9 # Source function library
10 . /etc/rc.d/init.d/functions
13 . /etc/sysconfig/network
15 # List of instances to start.
16 POUND_INSTANCES="pound"
19 [ -f /etc/sysconfig/pound ] && . /etc/sysconfig/pound
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
31 # check if the $1 instance is up
34 local pidfile=/var/run/pound/$instance.pid
35 [ -f $pidfile ] || return 1
36 local pid=$(cat $pidfile)
37 kill -0 $pid 2>/dev/null
43 # Check if the service is already running?
44 if [ ! -f /var/lock/subsys/pound -o "$single" = 1 ]; then
45 for instance in $POUND_INSTANCES; do
46 is_up $instance && continue
47 msg_starting "Pound ($instance)"
48 daemon pound -f /etc/pound/$instance.cfg -p /var/run/pound/$instance.pid
50 if [ $RETVAL -eq 0 ]; then
55 [ $started = 1 ] && touch /var/lock/subsys/pound
57 if [ -z "$ret" -a "$single" = 1 ]; then
58 msg_already_running "Pound ($instance)"
61 msg_already_running "Pound"
68 if [ -f /var/lock/subsys/pound ]; then
69 for instance in $POUND_INSTANCES; do
70 is_up $instance || continue
71 msg_stopping "Pound ($instance)"
72 killproc --pidfile pound/$instance.pid pound
75 [ "$single" != 1 ] && rm -f /var/lock/subsys/pound > /dev/null 2>&1
76 if [ -z "$ret" -a "$single" = 1 ]; then
77 msg_not_running "Pound ($instance)"
80 msg_not_running "Pound"
84 if [ "$1" != status -a "$2" ]; then
90 # See how we were called.
99 nls "Configured Pound instances:"
100 echo " $POUND_INSTANCES"
101 nls "Currently active Pound instances:"
103 for pidfile in /var/run/pound/*.pid; do
104 [ -f "$pidfile" ] || continue
105 instance=${pidfile#/var/run/pound/}
106 instance=${instance%.pid}
107 is_up $instance && echo -n " $instance($(cat $pidfile))"
113 restart|force-reload)
118 msg_usage "$0 {start|stop|restart|force-reload|status} [INSTANCE NAMES]"