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 [ $RETVAL -eq 0 ] && RETVAL=$ret
52 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pound
54 if [ -z "$ret" -a "$single" = 1 ]; then
55 msg_already_running "Pound ($instance)"
58 msg_already_running "Pound"
65 if [ -f /var/lock/subsys/pound ]; then
66 for instance in $POUND_INSTANCES; do
67 is_up $instance || continue
68 msg_stopping "Pound ($instance)"
69 killproc --pidfile pound/$instance.pid pound
72 [ "$single" != 1 ] && rm -f /var/lock/subsys/pound > /dev/null 2>&1
73 if [ -z "$ret" -a "$single" = 1 ]; then
74 msg_not_running "Pound ($instance)"
77 msg_not_running "Pound"
81 if [ "$1" != status -a "$2" ]; then
87 # See how we were called.
96 nls "Configured Pound instances:"
97 echo " $POUND_INSTANCES"
98 nls "Currently active Pound instances:"
100 for pidfile in /var/run/pound/*.pid; do
101 [ -f "$pidfile" ] || continue
102 instance=${pidfile#/var/run/pound/}
103 instance=${instance%.pid}
104 is_up $instance && echo -n " $instance($(cat $pidfile))"
110 restart|force-reload)
115 msg_usage "$0 {start|stop|restart|force-reload|status} [INSTANCE NAMES]"