[package] update haproxy to 1.4.1 and add hotplug script (#6875)
[openwrt/svn-archive/archive.git] / net / haproxy / files / haproxy.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2009-2010 OpenWrt.org
3
4 START=99
5 STOP=80
6
7 HAPROXY_BIN="/usr/sbin/haproxy"
8 HAPROXY_CONFIG="/etc/haproxy.cfg"
9 HAPROXY_PID="/var/run/haproxy.pid"
10
11 boot() {
12
13 #Do nothing on boot
14 exit 0
15 }
16
17 start() {
18 [ -x "$HAPROXY_BIN" ] || return 1
19
20 start-stop-daemon -S -x $HAPROXY_BIN -- \
21 -f "$HAPROXY_CONFIG" -V -D -p "$HAPROXY_PID"
22 }
23
24 stop() {
25 start-stop-daemon -q -K -x $HAPROXY_BIN -p $HAPROXY_PID
26 sleep 3
27 kill -0 `cat $HAPROXY_PID` 2>/dev/null && \
28 start-stop-daemon -q -K -s KILL -x $HAPROXY_BIN -p $HAPROXY_PID
29 }
30
31 reload() {
32 $HAPROXY_BIN -f $HAPROXY_CONFIG -p $HAPROXY_PID -st $(cat $HAPROXY_PID)
33 }