Commit f78838d7 authored by Andreas Bertsch's avatar Andreas Bertsch Committed by Milan P. Stanić
Browse files

main/haproxy: add support for directory based configuration

parent 89753187
......@@ -7,7 +7,7 @@ extra_commands="checkconfig"
extra_started_commands="reload"
command=/usr/sbin/haproxy
CONFFILE=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
CONF=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
PIDFILE=/var/run/${SVCNAME}.pid
depend() {
......@@ -17,20 +17,20 @@ depend() {
}
checkconfig() {
if [ ! -f "${CONFFILE}" ]; then
eerror "${CONFFILE} does not exist!"
if [ ! -f "${CONF}" ] && [ ! -d "${CONF}" ]; then
eerror "${CONF} does not exist!"
return 1
fi
ebegin "Checking ${CONFFILE}"
$command -q -c -f "${CONFFILE}"
ebegin "Checking ${CONF}"
$command -q -c -f "${CONF}"
eend $?
}
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --pidfile "${PIDFILE}" --exec $command \
--start -- -D -p "${PIDFILE}" -f "${CONFFILE}"
--start -- -D -p "${PIDFILE}" -f "${CONF}"
eend $?
}
......@@ -47,8 +47,8 @@ stop() {
reload() {
ebegin "Reloading ${SVCNAME}"
checkconfig || { eerror "Reloading failed, please fix your ${CONFFILE} first"; return 1; }
$command -D -p "${PIDFILE}" -f "${CONFFILE}" -sf $(cat "${PIDFILE}")
checkconfig || { eerror "Reloading failed, please fix your ${CONF} first"; return 1; }
$command -D -p "${PIDFILE}" -f "${CONF}" -sf $(cat "${PIDFILE}")
eend $?
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment