haproxy: Rework hotplug script for HAProxy
- Migrated init-script to procd. - Removed the old hotplug script as it is unnecessary and caused long boot-times for r7800 and possibly others. Signed-off-by: Christian Lachner <gladiac@gmail.com>
This commit is contained in:
parent
98a4cd0fd8
commit
c58d563120
3 changed files with 11 additions and 24 deletions
|
@ -172,8 +172,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)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$ACTION" = add ]; then
|
||||
/etc/init.d/haproxy enabled && \
|
||||
/etc/init.d/haproxy start
|
||||
fi
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue