haproxy/examples/init.haproxy
willy tarreau eedaa9f220 * released 1.1.23
* fixed a stupid bug introduced in 1.1.22 which caused second and subsequent
  'default' sections to keep previous parameters, and not initialize logs
  correctly.
* fixed a second stupid bug introduced in 1.1.22 which caused configurations
  relying on 'dispatch' mode to segfault at the first connection.
* 'option httpchk' now supports method, HTTP version and a few headers.
* now, 'option httpchk', 'cookie' and 'capture' can be specified in
  'defaults' section
* a fresh new english documentation
* large Makefile cleanup for increased portability
* new build script 'build.cfg' for Formilux-0.1.8
* new startup script 'init.haproxy.flx0' for Formilux-0.1.8
2005-12-17 14:08:03 +01:00

56 lines
1.0 KiB
Bash

#!/bin/sh
#
# config.rc sample with defaults :
# service haproxy
# config /etc/haproxy/haproxy.cfg
# maxconn 1024
#
config="/etc/haproxy/haproxy.cfg"
maxconn=1024
bin=/usr/sbin/haproxy
cmdline='$bin -D'
. $ROOT/sbin/init.d/default
if [ -e "$config" ]; then
maintfd=`grep '^\([^#]*\)\(listen\|server\)' $config|wc -l`
else
maintfd=0
fi
maxfd=$[$maxconn*2 + $maintfd]
if [ $maxfd -lt 100 ]; then
maxfd=100;
fi
cmdline="$cmdline -n $maxconn -f $config"
ulimit -n $maxfd
# to get a core when needed, uncomment the following :
# cd /var/tmp
# ulimit -c unlimited
# soft stop
function do_stop {
pids=`pidof -o $$ -- $PNAME`
if [ ! -z "$pids" ]; then
echo "Asking $PNAME to terminate gracefully..."
kill -USR1 $pids
echo "(use kill $pids to stop immediately)."
fi
}
# dump status
function do_status {
pids=`pidof -o $$ -- $PNAME`
if [ ! -z "$pids" ]; then
echo "Dumping $PNAME status in logs."
kill -HUP $pids
else
echo "Process $PNAME is not running."
fi
}
main $*