aboutsummaryrefslogtreecommitdiff
path: root/network/haproxy/rc.haproxy
blob: 6f224d7f7689f5e745a2762b00ea450f3b2ad80c (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
32
33
34
35
#!/bin/sh
#
# HAProxy daemon control script.
# 
# This is an init script for the haproxy daemon.
# To use haproxy, you must first set up the config file(s).
#
# Written for Slackware Linux by Cherife Li <cherife@dotimes.com>.
#

Bin=/usr/sbin/haproxy
CfgFile=/etc/haproxy/haproxy.cfg
PIDFile=/var/run/haproxy.pid

case "$1" in
  check)
    echo "Checking HAProxy configuration file..."
    $Bin -f $CfgFile -cV
    ;;
  start)
    echo "Starting HAProxy..."
    $Bin -f $CfgFile -D -p $PIDFile
    ;;
  stop)
    echo "Shutting down HAProxy..."
    kill -TERM `cat $PIDFile`
    rm -f $PIDFile
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "usage $0 {check|start|stop|restart}"
esac