dd8575ce4e259a046de241ff1fdb68dfa389da66
[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 start() {
12 [ -x "$HAPROXY_BIN" ] || return 1
13
14 start-stop-daemon -S -x $HAPROXY_BIN -- \
15 -f "$HAPROXY_CONFIG" -V -D -p "$HAPROXY_PID"
16 }
17
18 stop() {
19 start-stop-daemon -q -K -x $HAPROXY_BIN -p $HAPROXY_PID
20 sleep 3
21 kill -0 `cat $HAPROXY_PID` 2>/dev/null && \
22 start-stop-daemon -q -K -s KILL -x $HAPROXY_BIN -p $HAPROXY_PID
23 }
24
25 reload() {
26 $HAPROXY_BIN -f $HAPROXY_CONFIG -p $HAPROXY_PID -st $(cat $HAPROXY_PID)
27 }