Browse Source

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>
lilik-openwrt-22.03
Christian Lachner 5 years ago
parent
commit
9630b04433
3 changed files with 11 additions and 24 deletions
  1. +0
    -2
      net/haproxy/Makefile
  2. +0
    -7
      net/haproxy/files/haproxy.hotplug
  3. +11
    -15
      net/haproxy/files/haproxy.init

+ 0
- 2
net/haproxy/Makefile View File

@ -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)


+ 0
- 7
net/haproxy/files/haproxy.hotplug View File

@ -1,7 +0,0 @@
#!/bin/sh
if [ "$ACTION" = add ]; then
/etc/init.d/haproxy enabled && \
/etc/init.d/haproxy start
fi

+ 11
- 15
net/haproxy/files/haproxy.init View File

@ -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…
Cancel
Save