haproxy - Upstart 工作(haproxy)

标签 haproxy upstart

我正在使用以下命令启动 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/

相关文章:

tomcat - 用于子域重定向的 HAProxy 配置

timeout - Haproxy "timeout server"针对特定操作

scala - Upstart 的 daemonUser 无法在 sbt-native-packager 中工作

ubuntu - 重启 Upstart 实例进程

linux - 运行 bash 脚本,在启动时自动打开终端

linux - 启动 Upstart 任务 - 未知作业错误

http - 在 nginx 中处理 OPTIONS 请求

python-3.x - 如何使用 fastapi 日志记录捕获 X-Forwarded-For?

node.js - comet 与 node.js 的 250k 连接

python - python脚本的守护进程与 Upstart