【问题标题】:Upstart tracking wrong PID of Bluepill新贵跟踪 Bluepill 的错误 PID
【发布时间】:2013-07-10 00:36:50
【问题描述】:

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

使用 Ubuntu 12.04。

我正在使用 Ubuntu 的 upstart 启动和监控 bluepill 服务本身。我的新贵配置如下 (/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 强行终止 bluepill,这会阻止 bluepill 进程重新生成。

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

这可能是什么问题?

【问题讨论】:

    标签: linux ubuntu upstart bluepill


    【解决方案1】:

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

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

    来自 bluepill 文档:

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

    将在前台运行 bluepill

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-02
      • 1970-01-01
      • 2015-03-15
      • 2015-11-19
      • 1970-01-01
      • 1970-01-01
      • 2011-05-12
      相关资源
      最近更新 更多