[packages] add HAProxy, a high performance HTTP/TCP reverse proxy and load balancer...
[openwrt/svn-archive/archive.git] / net / haproxy / files / haproxy.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2009 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 -d -p "$HAPROXY_PID"
16 }
17
18 stop() {
19 start-stop-daemon -K -x $HAPROXY_BIN -p $HAPROXY_PID
20 rm -f $HAPROXY_PID
21 }
22
23 reload() {
24 [ ! -f "$HAPROXY_PID" ] && start
25 $HAPROXY_BIN -f $HAPROXY_CONFIG -p $HAPROXY_PID -st $(cat $HAPROXY_PID)
26 }