aboutsummaryrefslogtreecommitdiff
path: root/network/haproxy/rc.haproxy
blob: 5663cc37a14e2e9fa09db367fa1ac4c72b324e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
# HAProxy daemon control script.
# Written for Slackware Linux by Cherife Li <cherife-#-dotimes.com>.

BIN=/usr/sbin/haproxy
CONF=/etc/haproxy/haproxy.cfg
PID=/var/run/haproxy.pid

case "$1" in
  check)
    echo "Checking HAProxy configuration file..."
    $BIN -f $CONF -cV
    ;;
  start)
    echo "Starting HAProxy..."
    $BIN -f $CONF -D -p $PID
    ;;
  stop)
    echo "Shutting down HAProxy..."
    kill -TERM `cat $PID`
    rm -f $PID &> /dev/null
    ;;
  restart)
    stop
    sleep 2
    start
    ;;
  *)
    echo "usage `basename $0` {check|start|stop|restart}"
esac