Upstart工作(haproxy)

3

我正在使用以下命令启动HA代理:
sudo etc/init.d/haproxy start
我停止HA代理的方式是:
sudo etc/init.d/haproxy stop

如何编写基本的upstart脚本以启动或停止sudo etc/init.d/something ?

1个回答

4
以下脚本可用。将其放在“/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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接