我正在尝试使用 upstart 来保持服务运行:rabbitmq-server。
我已经在 /etc/init/rabbitmq.conf 中编写了一个 upstart 配置文件
1
2 start on runlevel [2345]
3 stop on runlevel [016]
4
5 respawn
6 exec /etc/init.d/rabbitmq-server start
问题是,这个脚本认为 rabbitmq-server 在运行后就崩溃了,它会继续尝试重新启动它,直到 upstart 确定它重新启动的次数太多而最终退出:
Aug 29 19:01:47 WORKER1 kernel: [ 1334.301258] init: rabbitmq main process ended, respawning
Aug 29 19:01:48 WORKER1 kernel: [ 1334.740770] init: rabbitmq main process ended, respawning
Aug 29 19:01:48 WORKER1 kernel: [ 1335.227660] init: rabbitmq main process ended, respawning
Aug 29 19:01:49 WORKER1 kernel: [ 1335.721948] init: rabbitmq respawning too fast, stopped
我如何编写 upstart 脚本来保持服务运行?