#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2019 OpenWrt.org

START=99
STOP=80

USE_PROCD=1

HAPROXY_BIN="/usr/sbin/haproxy"
HAPROXY_CONFIG="/etc/haproxy.cfg"

start_service() {
	procd_open_instance
	procd_set_param respawn
	procd_set_param file "$HAPROXY_CONFIG"
	procd_set_param reload_signal USR2
	procd_set_param command $HAPROXY_BIN -q -W -db -f "$HAPROXY_CONFIG"
	procd_close_instance
}

EXTRA_COMMANDS="check"
EXTRA_HELP="	check Check haproxy config"

check() {
	$HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG
}
