5

我有 bluepill 设置来监控我的延迟作业流程。

使用 Ubuntu 12.04。

我正在使用 Ubuntu 的upstart. 我的新贵配置低于(/etc/init/bluepill.conf)。

description "Start up the bluepill service"

start on runlevel [2]
stop on runlevel [016]

expect fork
exec sudo /home/deploy/.rvm/wrappers/<app_name>/bluepill load /home/deploy/websites/<app_name>/current/config/server/staging/delayed_job.bluepill

# Restart the process if it dies with a signal
# or exit code not given by the 'normal exit' stanza.
respawn

我也试过用expect daemon而不是expect fork. 我也尝试过expect...完全删除这条线。

当机器启动时,bluepill 启动正常。

$ ps aux | grep blue
root      1154  0.6  0.8 206416 17372 ?        Sl   21:19   0:00 bluepilld: <app_name>

bluepill 进程的 PID 在这里是 1154。但upstart似乎正在跟踪错误的 PID。

$ initctl status bluepill
bluepill start/running, process 990

如果我使用kill -9.

此外,我认为由于跟踪的 PID 错误,重新启动/关机只是挂起,我每次都必须硬重置机器。

这里可能是什么问题?

4

1 回答 1

0

显然,新贵跟踪错误的 PID。从bluepill源代码来看,它使用daemons gem 来守护进程,而后者又分叉了两次。所以expect daemon在 upstart 配置中应该跟踪正确的 PID——但你已经尝试过了。

如果可能的话,你应该在前台运行bluepillexpect ,并且不要在你的 upstart 配置中使用任何节。

蓝药文档:

Bluepill.application("app_name", :foreground => true) do |app|
  # ...
end

将在前台运行bluepill

于 2014-04-26T22:12:45.337 回答