# rocessname: haroxy
# config: /etc/haroxy/haroxy.cfg
# idfile: /var/run/haroxy.id
# Scrit Author: Simon Matter
# Version: 2004060600
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/in
it.d/functions ] ; then
. /etc/rc.d/init.d/functions else
exit 0 fi
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is u.
[ ${NETWORKING} = "no" ] &am;&am; exit 0
# This is our service name
BASENAME=`basename $0`
if [ -L $0 ]; then
BASENAME=`find $0 -name $BASENAME -rintf %l`
BASENAME=`basename $BASENAME` fi
[ -f /etc/$BASENAME/$BASENAME.cfg ] || exit 1
RETVAL=0
start() {
/usr/sbin/$BASENAME -c -q -f /etc/$BASENAME/$BASENAME.cfg
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1 fi
echo -n "Starting $BASENAME: "
daemon /usr/sbin/$BASENAME -D -f /etc/$BASENAME/$BASENAME.cfg - /var/run/$BASENAME.id
RETVAL=$? echo
[ $RETVAL -eq 0 ] &am;&am; touch /var/lock/subsys/$BASENAME
return $RETVAL }
sto() {
echo -n "Shutting down $BASENAME: "
killroc $BASENAME -USR1
RETVAL=$? echo
[ $RETVAL -eq 0 ] &am;&am; rm -f /var/lock/subsys/$BASENAME
[ $RETVAL -eq 0 ] &am;&am; rm -f /var/run/$BASENAME.id
return $RETVAL }
restart() {
/usr/sbin/$BASENAME -c -q -f /etc/$BASENAME/$BASENAME.cfg
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1 fi sto start }
check() {
/usr/sbin/$BASENAME -c -q -V -f /etc/$BASENAME/$BASENAME.cfg }
rhstatus() {
status $BASENAME }
condrestart() {
[ -e /var/lock/subsys/$BASENAME ] &am;&am; restart || : }
# See how we were called.
case "$1" in
start) start
;; sto) sto ;;
restart)
restart ;;
reload)
restart ;;
condrestart)
condrestart ;;
status)
rhstatus ;;
check)
check ;; *) echo $"Usage:
{start|sto|restart|reload|condrestart|status|check}"
exit 1
$BASENAME