#!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ HAPROXY=/usr/bin/haproxy HAPROXY_CONF=/etc/haproxy/haproxy.cfg HAPROXY_PID=/var/run/haproxy.pid checkconfig() { if [[ ! -f ${HAPROXY_CONF} ]] ; then ewarn "${HAPROXY_CONF} does not exist." return 1 fi ${HAPROXY} -c -f ${HAPROXY_CONF} >/dev/null } depend() { need net use dns logger } start() { checkconfig || return 1 ebegin "Starting haproxy" start-stop-daemon --start --quiet --pidfile ${HAPROXY_PID} \ --exec ${HAPROXY} \ -- -D -p ${HAPROXY_PID} -f ${HAPROXY_CONF} eend ${?} } stop() { ebegin "Stopping haproxy" start-stop-daemon --stop --quiet --pidfile ${HAPROXY_PID} eend ${?} }