diff --git a/net/haproxy/Makefile b/net/haproxy/Makefile index e762badbf..bb92f6604 100644 --- a/net/haproxy/Makefile +++ b/net/haproxy/Makefile @@ -171,8 +171,6 @@ define Package/haproxy/install $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy - $(INSTALL_DIR) $(1)/etc/hotplug.d/net - $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/net/90-haproxy endef Package/haproxy-nossl/install = $(Package/haproxy/install) diff --git a/net/haproxy/files/haproxy.hotplug b/net/haproxy/files/haproxy.hotplug deleted file mode 100644 index bfb5d6da1..000000000 --- a/net/haproxy/files/haproxy.hotplug +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -if [ "$ACTION" = add ]; then - /etc/init.d/haproxy enabled && \ - /etc/init.d/haproxy start -fi - diff --git a/net/haproxy/files/haproxy.init b/net/haproxy/files/haproxy.init index 52bc126ac..de5695204 100644 --- a/net/haproxy/files/haproxy.init +++ b/net/haproxy/files/haproxy.init @@ -1,29 +1,25 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2009-2010 OpenWrt.org +# Copyright (C) 2009-2019 OpenWrt.org START=99 STOP=80 -SERVICE_USE_PID=1 +USE_PROCD=1 + EXTRA_COMMANDS="check" HAPROXY_BIN="/usr/sbin/haproxy" HAPROXY_CONFIG="/etc/haproxy.cfg" -HAPROXY_PID="/var/run/haproxy.pid" - -start() { - service_start $HAPROXY_BIN -q -D -f "$HAPROXY_CONFIG" -p "$HAPROXY_PID" -} - -stop() { - kill -9 $(cat $HAPROXY_PID | tr "\n" " ") - service_stop $HAPROXY_BIN -} -reload() { - $HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID) +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 } check() { - $HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG + $HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG }