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.
 
 
 
 
 
 

56 lines
1.6 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.haproxy -- Run-Commands
##
%config
haproxy_enable="$openpkg_rc_def"
haproxy_log_prolog="true"
haproxy_log_epilog="true"
haproxy_log_numfiles="10"
haproxy_log_minsize="1M"
haproxy_log_complevel="9"
%common
haproxy_cfgfile="@l_prefix@/etc/haproxy/haproxy.cfg"
haproxy_logfile="@l_prefix@/var/haproxy/log/haproxy.log"
haproxy_pidfile="@l_prefix@/var/haproxy/run/haproxy.pid"
haproxy_signal () {
[ -f $haproxy_pidfile ] && kill -$1 `cat $haproxy_pidfile`
}
%status -u @l_susr@ -o
haproxy_usable="unknown"
haproxy_active="no"
rcService haproxy enable yes && \
haproxy_signal 0 && haproxy_active="yes"
echo "haproxy_enable=\"$haproxy_enable\""
echo "haproxy_usable=\"$haproxy_usable\""
echo "haproxy_active=\"$haproxy_active\""
%start -u @l_susr@
rcService haproxy enable yes || exit 0
rcService haproxy active yes && exit 0
@l_prefix@/sbin/haproxy -f $haproxy_cfgfile
%stop -u @l_susr@
rcService haproxy enable yes || exit 0
rcService haproxy active no && exit 0
haproxy_signal TERM
sleep 2
rm -f $haproxy_pidfile >/dev/null 2>&1 || true
%restart -u @l_susr@
rcService haproxy enable yes || exit 0
rcService haproxy active no && exit 0
rc haproxy stop start
%daily -u @l_susr@
rcService haproxy enable yes || exit 0
shtool rotate -f \
-n $haproxy_log_numfiles -s $haproxy_log_minsize -d \
-z $haproxy_log_complevel -m 664 -o @l_nusr@ -g @l_ngrp@ \
-P "$haproxy_log_prolog" \
-E "$haproxy_log_epilog; rc haproxy restart" \
$haproxy_logfile