我正在使用以下命令启动 HA 代理:
sudo etc/init.d/haproxy start
我使用以下方法停止 HA 代理:
sudo etc/init.d/haproxy stop
我如何为 sudo etc/init.d/something start 或 stop 编写基本的 upstart 脚本?
最佳答案
以下脚本将起作用。把它放在“/etc/init/haproxy.conf”中,然后你可以用“service haproxy start”启动haproxy服务。一定要检查配置文件的位置
# HAProxy
description "HAProxy"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 2 5
env CONF=/etc/haproxy/haproxy.cfg
pre-start script
[ -r $CONF ]
end script
exec /usr/local/sbin/haproxy -db -f $CONF
关于haproxy - Upstart 工作(haproxy),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12531648/