gpt4 book ai didi

linux - Upstart 跟踪错误的 Bluepill PID

转载 作者:IT王子 更新时间:2023-10-29 00:44:00 25 4
gpt4 key购买 nike

我有 bluepill 设置来监控我的 delayed_job 进程。

使用 Ubuntu 12.04。

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

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

这可能是什么问题?

最佳答案

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

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

来自 bluepill 文档:

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

将在前台运行 bluepill

关于linux - Upstart 跟踪错误的 Bluepill PID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17598471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com