2
vagrant@lucid32:/vagrant$ bundle exec unicorn_rails -c config/unicorn.rb -D -d
{:unicorn_options=>{:listeners=>[], :config_file=>"config/unicorn.rb"},
 :app=>
  #<Proc:0xa1a6ef4@/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn_rails:135 (lambda)>,
 :daemonize=>true}
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/cache
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/pids
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/sessions
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/sockets
Exception `EOFError' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/launcher.rb:46 - end of file reached
master failed to start, check stderr log for details

不幸的是,我不知道如何检查 stderr 日志并且找不到任何相关信息。

这是配置文件:

working_directory "/vagrant"
pid "/vagrant/tmp/pids/unicorn.pid"
stderr_path "/vagrant/log/unicorn.log"
stdout_path "/vagrant/log/unicorn.log"

listen "/tmp/unicorn.todo.sock"
worker_processes 2
timeout 30

这是 nginx.conf 文件

upstream unicorn {
  server unix:/tmp/unicorn.todo.sock fail_timeout=0;
}


server {
  listen 80 default;
  # server_name example.com;
  root /vagrant/public;
  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
      proxy_pass  http://unicorn;
  }

  error_page 500 502 503 504 /500.html;
}

现在的问题是没有创建 /tmp 目录。所以我创建了它,我得到了同样的错误,然后我删除了它,我得到了同样的错误。现在我陷入了无限循环。

我将不胜感激有关 ho 的任何帮助以使这项工作或至少如何阅读错误日志。

编辑:我能够找到标准错误文件:

/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.2278780536507904.2128, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.8313958669768073.2187, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.9130633695817217.2190, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
Exception `Errno::ENOENT' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:683 - No such file or directory - /vagrant/tmp/pids/unicorn.pid
Exception `Errno::ETXTBSY' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207 - Text file busy - (/vagrant/tmp/pids/0.59100125503182.2237, /vagrant/tmp/pids/unicorn.pid)
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.59100125503182.2237, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.4331021743697998.2271, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
Exception `Errno::ENOENT' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:683 - No such file or directory - /vagrant/tmp/pids/unicorn.pid
4

2 回答 2

1

Unicorn process is running in background(-d), type below command on teminal

ps aux | grep unicorn

and kill running unicorn process then start unicorn again.

于 2013-07-08T19:35:21.120 回答
0

我遇到了同样的问题(Text file busy错误),也是从 Vagrant VM 运行的。@destiel 的评论帮助我解决了这个问题:显然这是由运行railsunicorn来自 Vagrant 共享文件夹引起的。复制到虚拟驱动器后,它工作正常。我在 Windows 8 主机上运行,​​以防万一。

于 2014-12-18T18:35:12.270 回答