Anj*_*jan 5 linux ubuntu upstart bluepill
我有bluepill设置来监控我的delayed_job进程.
使用Ubuntu 12.04.
我正在使用Ubuntu启动并监控bluepill服务本身upstart.我的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
Run Code Online (Sandbox Code Playgroud)
我也试过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>
Run Code Online (Sandbox Code Playgroud)
bluepill过程的PID在这里是1154.但upstart似乎跟踪错误的PID.
$ initctl status bluepill
bluepill start/running, process 990
Run Code Online (Sandbox Code Playgroud)
如果我使用强制杀死bluepill,这可以防止bluepill进程重生kill -9.
此外,我认为由于跟踪了错误的PID,重新启动/关闭只是挂起而我每次都必须硬重置机器.
这可能是什么问题?
显然,upstart 跟踪了错误的 PID。从bluepill源码来看,它使用daemons gem进行守护进程,进而fork两次。所以expect daemon在新贵配置中应该跟踪正确的 PID——但您已经尝试过了。
如果可能的话,您应该在前台运行bluepill ,而不是使用任何expect ,并且在您的新贵配置中根本不使用任何节。
来自bluepill文档:
Bluepill.application("app_name", :foreground => true) do |app|
# ...
end
Run Code Online (Sandbox Code Playgroud)
将在前台运行bluepill 。