#!/bin/bash
### BEGIN INIT INFO
#Manage the HAProxy
### END INIT INFO
bin=/usr/local/haproxy/sbin/haproxy
config=/usr/local/haproxy/conf/haproxy.cfg
pid=/usr/local/haproxy/haproxy.pid
opts=" -f ${config} -p ${pid} -D -V "
sleep_time=1
start() {
echo -e "Starting HAProxy......"
${bin} ${opts}
if [ "$?" != "0" ] ; then
sleep ${sleep_time}
echo " failed"
exit 1
else
sleep ${sleep_time}
echo " done"
fi
}
stop() {
if [ ! -e ${pid} ] ; then
echo -e "HAProxy is not running"
exit 0
fi
echo -e "Shutting down HAProxy......"
kill $(cat ${pid})
if [ -e ${pid} ] ; then
rm -f ${pid}
fi
if [ "$?" != "0" ] ; then
sleep ${sleep_time}
echo " failed"
exit 1
else
sleep ${sleep_time}
echo " done"
fi
}
reload(){
${bin} -f ${config} -st $(cat ${pid})
echo -e "HAProxy is reload......"
}
checkconfig(){
${bin} -c -f ${config}
echo -e "haproxy file is ok"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
checkconfig)
checkconfig
;;
*)
echo "Usage: $0 {start|stop|restart|reload|checkconfig}"
exit 1
;;
esac
转载于:https://blog.51cto.com/caozm/1335274
最后
以上就是凶狠蛋挞最近收集整理的关于haproxy重启动,检查文件的脚本的全部内容,更多相关haproxy重启动,检查文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复