我正在尝试使用Bluepill重新启动Unicorn以防万一它崩溃了,并且我一生都无法正常工作。手动启动Unicorn效果很好。
我正在像这样向Bluepill发送命令:bundle exec bluepill --no-privileged <some command>
当尝试启动Unicorn时,Bluepill日志显示为:
WARN -- : [myapp:unicorn] Executing start command: /etc/init.d/unicorn_myapp start
WARN -- : [myapp:unicorn] Start command execution returned non-zero exit code:
WARN -- : [myapp:unicorn] {:stdout=>"", :stderr=>"/etc/init.d/unicorn_myapp: 24: kill: No such process\n\nmaster failed to start, check stderr log for details\n", :exit_code=>1}
它引用了我的Unicorn shell脚本的第24行,即:
PID=$APP_ROOT/tmp/pids/unicorn.pid
# ...other stuff here...
sig () {
test -s "$PID" && kill -$1 `cat $PID` # this is line 24
}
当我查看Unicorn的错误日志时,会看到以下内容:
INFO -- : Refreshing Gem list
bundler: failed to load command: unicorn_rails (/home/deployer/apps/myapp/shared/bundle/ruby/2.2.0/bin/unicorn_rails)
LoadError: cannot load such file -- sass-rails
我可以通过几种方式手动重启Unicorn:
/etc/init.d/unicorn_myapp start
bundle exec unicorn_rails -c config/unicorn.rb -D
它确实输出<{>> /etc/init.d/unicorn_myapp: 24: kill: No such process
,尽管它正常启动。
Bluepill配置:
app_home = "/home/deployer/apps/myapp"
Bluepill.application("myapp", log_file: "#{app_home}/shared/log/bluepill.log") do |app|
app.uid = "deployer"
app.gid = "deployer"
app.process("unicorn") do |process|
process.working_dir = "#{app_home}"
process.start_grace_time = 60.seconds
process.stop_grace_time = 60.seconds
process.restart_grace_time = 60.seconds
process.start_command = "/etc/init.d/unicorn_myapp start"
process.stop_command = "start-stop-daemon --signal QUIT --stop --pidfile #{app_home}/current/tmp/pids/unicorn.pid"
process.pid_file = "#{app_home}/current/tmp/pids/unicorn.pid"
end
end
我应该提到,我能够使用Bluepill成功地监视,停止和启动delay_job。我还可以监视和停止独角兽,但不能启动它。
如果有问题,我正在使用RVM。