標籤:haproxy 啟動
指令碼如下:
#!/bin/sh# chkconfig 2345 on# description: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.if [ -f /etc/init.d/functions ]; then. /etc/init.d/functionselif [ -f /etc/rc.d/init.d/functions ] ; then. /etc/rc.d/init.d/functionselseexit 0fi# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ ${NETWORKING} = "no" ] && exit 0config="/etc/haproxy/haproxy.cfg"exec="/usr/local/haproxy/sbin/haproxy"PID="/var/run/haproxy.pid"[ -f $config ] || exit 1RETVAL=0start() { daemon $exec -c -q -f $config if [ $? -ne 0 ]; then echo "Errors found in configuration file." return 1 fi echo -n "Starting HAproxy: " $exec -D -f $config -p $PID RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/haproxy return $RETVAL}stop() {echo -n "Shutting down HAproxy: "killproc haproxy -USR1RETVAL=$?echo[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/haproxy[ $RETVAL -eq 0 ] && rm -f $PIDreturn $RETVAL}restart() {$exec -c -q -f $config if [ $? -ne 0 ]; then echo "Errors found in configuration file, check it with ‘haproxy check‘." return 1 fistopstart}rhstatus() {status haproxy}# See how we were called.case "$1" instart) start ;;stop) stop ;;restart) restart ;;status) rhstatus ;;*) echo $"Usage: haproxy {start|stop|restart|status}" RETVAL=1 esac exit $RETVAL
本文出自 “不求最好,只求更好” 部落格,請務必保留此出處http://yujianglei.blog.51cto.com/7215578/1725994
Haproxy啟動指令碼