You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 lines
1.8 KiB

#!/bin/sh
#
# haproxy
#
# chkconfig: - 85 15
# description: HAProxy is a free, very fast and reliable solution \
# offering high availability, load balancing, and \
# proxying for TCP and HTTP-based applications
# processname: haproxy
# config: /etc/kazoo/haproxy/haproxy.cfg
# pidfile: /var/run/haproxy/kazoo-haproxy.pid
RETVAL=0
PID_FILE=${PID_FILE:-/var/run/haproxy/kazoo-haproxy.pid}
LOCK_FILE=/var/lock/subsys/kazoo-haproxy
. /etc/rc.d/init.d/functions
start() {
echo -n $"Starting HAProxy: "
/usr/sbin/kazoo-haproxy prepare >/dev/null 2>&1
daemon --pidfile ${PID_FILE} "/usr/sbin/kazoo-haproxy start >/dev/null 2>&1"
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
touch ${LOCK_FILE}
success $"OK"
echo
else
failure $"HAProxy is already running or failed to start!"
echo
fi
}
stop() {
echo -n $"Stopping HAProxy: "
/usr/sbin/kazoo-haproxy stop >/dev/null 2>&1
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
rm -f ${LOCK_FILE} ${pidfile}
success $"OK"
echo
else
failure $"HAProxy is still running!"
echo
fi
}
status() {
/usr/sbin/kazoo-haproxy status
RETVAL=$?
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
check)
/usr/sbin/kazoo-haproxy check
;;
restart|reload)
restart
;;
condrestart)
[ ! -e ${LOCK_FILE} ] && restart
;;
*)
echo $"Usage: $0 (start|stop|restart|status|check)"
RETVAL=1
esac
exit ${RETVAL}