#!/bin/sh # # pound # # chkconfig: 345 85 15 # description: reverse-proxy and load-balancer # # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # List of instances to start. POUND_INSTANCES="pound" # Get service config [ -f /etc/sysconfig/pound ] && . /etc/sysconfig/pound # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down pound exit 1 fi else exit 0 fi start() { for instance in $POUND_INSTANCES; do # Check if the service is already running? if [ ! -f /var/lock/subsys/pound-$instance ]; then msg_starting "Pound ($instance)" daemon pound -f /etc/pound/$instance.cfg -p /var/run/pound/$instance.pid RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pound-$instance else msg_already_running "Pound ($instance)" fi done } stop() { # Stop daemons. for instance in $POUND_INSTANCES; do if [ -f /var/lock/subsys/pound-$instance ]; then msg_stopping "Pound ($instance)" killproc --pidfile pound/$instance.pid pound rm -f /var/lock/subsys/pound-$instance > /dev/null 2>&1 else msg_not_running "Pound ($instance)" fi done } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status pound exit $? ;; restart|force-reload) stop start ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac exit $RETVAL